1
|
|
|
/******/ (function(modules) { // webpackBootstrap |
2
|
|
|
/******/ // The module cache |
3
|
|
|
/******/ var installedModules = {}; |
4
|
|
|
/******/ |
5
|
|
|
/******/ // The require function |
6
|
|
|
/******/ function __webpack_require__(moduleId) { |
7
|
|
|
/******/ |
8
|
|
|
/******/ // Check if module is in cache |
9
|
|
|
/******/ if(installedModules[moduleId]) |
10
|
|
|
/******/ return installedModules[moduleId].exports; |
11
|
|
|
/******/ |
12
|
|
|
/******/ // Create a new module (and put it into the cache) |
13
|
|
|
/******/ var module = installedModules[moduleId] = { |
14
|
|
|
/******/ i: moduleId, |
15
|
|
|
/******/ l: false, |
16
|
|
|
/******/ exports: {} |
17
|
|
|
/******/ }; |
18
|
|
|
/******/ |
19
|
|
|
/******/ // Execute the module function |
20
|
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
21
|
|
|
/******/ |
22
|
|
|
/******/ // Flag the module as loaded |
23
|
|
|
/******/ module.l = true; |
24
|
|
|
/******/ |
25
|
|
|
/******/ // Return the exports of the module |
26
|
|
|
/******/ return module.exports; |
27
|
|
|
/******/ } |
28
|
|
|
/******/ |
29
|
|
|
/******/ |
30
|
|
|
/******/ // expose the modules object (__webpack_modules__) |
31
|
|
|
/******/ __webpack_require__.m = modules; |
32
|
|
|
/******/ |
33
|
|
|
/******/ // expose the module cache |
34
|
|
|
/******/ __webpack_require__.c = installedModules; |
35
|
|
|
/******/ |
36
|
|
|
/******/ // identity function for calling harmony imports with the correct context |
37
|
|
|
/******/ __webpack_require__.i = function(value) { return value; }; |
38
|
|
|
/******/ |
39
|
|
|
/******/ // define getter function for harmony exports |
40
|
|
|
/******/ __webpack_require__.d = function(exports, name, getter) { |
41
|
|
|
/******/ if(!__webpack_require__.o(exports, name)) { |
42
|
|
|
/******/ Object.defineProperty(exports, name, { |
43
|
|
|
/******/ configurable: false, |
44
|
|
|
/******/ enumerable: true, |
45
|
|
|
/******/ get: getter |
46
|
|
|
/******/ }); |
47
|
|
|
/******/ } |
48
|
|
|
/******/ }; |
49
|
|
|
/******/ |
50
|
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules |
51
|
|
|
/******/ __webpack_require__.n = function(module) { |
52
|
|
|
/******/ var getter = module && module.__esModule ? |
53
|
|
|
/******/ function getDefault() { return module['default']; } : |
54
|
|
|
/******/ function getModuleExports() { return module; }; |
55
|
|
|
/******/ __webpack_require__.d(getter, 'a', getter); |
56
|
|
|
/******/ return getter; |
57
|
|
|
/******/ }; |
58
|
|
|
/******/ |
59
|
|
|
/******/ // Object.prototype.hasOwnProperty.call |
60
|
|
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
61
|
|
|
/******/ |
62
|
|
|
/******/ // __webpack_public_path__ |
63
|
|
|
/******/ __webpack_require__.p = "./"; |
64
|
|
|
/******/ |
65
|
|
|
/******/ // Load entry module and return exports |
66
|
|
|
/******/ return __webpack_require__(__webpack_require__.s = 34); |
67
|
|
|
/******/ }) |
68
|
|
|
/************************************************************************/ |
69
|
|
|
/******/ ({ |
70
|
|
|
|
71
|
|
|
/***/ 1: |
72
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
73
|
|
|
|
74
|
|
|
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
75
|
|
|
* jQuery JavaScript Library v3.3.1 |
76
|
|
|
* https://jquery.com/ |
77
|
|
|
* |
78
|
|
|
* Includes Sizzle.js |
79
|
|
|
* https://sizzlejs.com/ |
80
|
|
|
* |
81
|
|
|
* Copyright JS Foundation and other contributors |
82
|
|
|
* Released under the MIT license |
83
|
|
|
* https://jquery.org/license |
84
|
|
|
* |
85
|
|
|
* Date: 2018-01-20T17:24Z |
86
|
|
|
*/ |
87
|
|
|
( function( global, factory ) { |
88
|
|
|
|
89
|
|
|
"use strict"; |
90
|
|
|
|
91
|
|
|
if ( typeof module === "object" && typeof module.exports === "object" ) { |
92
|
|
|
|
93
|
|
|
// For CommonJS and CommonJS-like environments where a proper `window` |
94
|
|
|
// is present, execute the factory and get jQuery. |
95
|
|
|
// For environments that do not have a `window` with a `document` |
96
|
|
|
// (such as Node.js), expose a factory as module.exports. |
97
|
|
|
// This accentuates the need for the creation of a real `window`. |
98
|
|
|
// e.g. var jQuery = require("jquery")(window); |
99
|
|
|
// See ticket #14549 for more info. |
100
|
|
|
module.exports = global.document ? |
101
|
|
|
factory( global, true ) : |
102
|
|
|
function( w ) { |
103
|
|
|
if ( !w.document ) { |
104
|
|
|
throw new Error( "jQuery requires a window with a document" ); |
105
|
|
|
} |
106
|
|
|
return factory( w ); |
107
|
|
|
}; |
108
|
|
|
} else { |
109
|
|
|
factory( global ); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
// Pass this if window is not defined yet |
113
|
|
|
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { |
114
|
|
|
|
115
|
|
|
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 |
116
|
|
|
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode |
117
|
|
|
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common |
118
|
|
|
// enough that all such attempts are guarded in a try block. |
119
|
|
|
"use strict"; |
120
|
|
|
|
121
|
|
|
var arr = []; |
122
|
|
|
|
123
|
|
|
var document = window.document; |
124
|
|
|
|
125
|
|
|
var getProto = Object.getPrototypeOf; |
126
|
|
|
|
127
|
|
|
var slice = arr.slice; |
128
|
|
|
|
129
|
|
|
var concat = arr.concat; |
130
|
|
|
|
131
|
|
|
var push = arr.push; |
132
|
|
|
|
133
|
|
|
var indexOf = arr.indexOf; |
134
|
|
|
|
135
|
|
|
var class2type = {}; |
136
|
|
|
|
137
|
|
|
var toString = class2type.toString; |
138
|
|
|
|
139
|
|
|
var hasOwn = class2type.hasOwnProperty; |
140
|
|
|
|
141
|
|
|
var fnToString = hasOwn.toString; |
142
|
|
|
|
143
|
|
|
var ObjectFunctionString = fnToString.call( Object ); |
144
|
|
|
|
145
|
|
|
var support = {}; |
146
|
|
|
|
147
|
|
|
var isFunction = function isFunction( obj ) { |
148
|
|
|
|
149
|
|
|
// Support: Chrome <=57, Firefox <=52 |
150
|
|
|
// In some browsers, typeof returns "function" for HTML <object> elements |
151
|
|
|
// (i.e., `typeof document.createElement( "object" ) === "function"`). |
152
|
|
|
// We don't want to classify *any* DOM node as a function. |
153
|
|
|
return typeof obj === "function" && typeof obj.nodeType !== "number"; |
154
|
|
|
}; |
155
|
|
|
|
156
|
|
|
|
157
|
|
|
var isWindow = function isWindow( obj ) { |
158
|
|
|
return obj != null && obj === obj.window; |
159
|
|
|
}; |
160
|
|
|
|
161
|
|
|
|
162
|
|
|
|
163
|
|
|
|
164
|
|
|
var preservedScriptAttributes = { |
165
|
|
|
type: true, |
166
|
|
|
src: true, |
167
|
|
|
noModule: true |
168
|
|
|
}; |
169
|
|
|
|
170
|
|
|
function DOMEval( code, doc, node ) { |
171
|
|
|
doc = doc || document; |
172
|
|
|
|
173
|
|
|
var i, |
174
|
|
|
script = doc.createElement( "script" ); |
175
|
|
|
|
176
|
|
|
script.text = code; |
177
|
|
|
if ( node ) { |
178
|
|
|
for ( i in preservedScriptAttributes ) { |
179
|
|
|
if ( node[ i ] ) { |
180
|
|
|
script[ i ] = node[ i ]; |
181
|
|
|
} |
182
|
|
|
} |
183
|
|
|
} |
184
|
|
|
doc.head.appendChild( script ).parentNode.removeChild( script ); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
|
188
|
|
|
function toType( obj ) { |
189
|
|
|
if ( obj == null ) { |
190
|
|
|
return obj + ""; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
// Support: Android <=2.3 only (functionish RegExp) |
194
|
|
|
return typeof obj === "object" || typeof obj === "function" ? |
195
|
|
|
class2type[ toString.call( obj ) ] || "object" : |
196
|
|
|
typeof obj; |
197
|
|
|
} |
198
|
|
|
/* global Symbol */ |
199
|
|
|
// Defining this global in .eslintrc.json would create a danger of using the global |
200
|
|
|
// unguarded in another place, it seems safer to define global only for this module |
201
|
|
|
|
202
|
|
|
|
203
|
|
|
|
204
|
|
|
var |
205
|
|
|
version = "3.3.1", |
206
|
|
|
|
207
|
|
|
// Define a local copy of jQuery |
208
|
|
|
jQuery = function( selector, context ) { |
209
|
|
|
|
210
|
|
|
// The jQuery object is actually just the init constructor 'enhanced' |
211
|
|
|
// Need init if jQuery is called (just allow error to be thrown if not included) |
212
|
|
|
return new jQuery.fn.init( selector, context ); |
213
|
|
|
}, |
214
|
|
|
|
215
|
|
|
// Support: Android <=4.0 only |
216
|
|
|
// Make sure we trim BOM and NBSP |
217
|
|
|
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; |
218
|
|
|
|
219
|
|
|
jQuery.fn = jQuery.prototype = { |
220
|
|
|
|
221
|
|
|
// The current version of jQuery being used |
222
|
|
|
jquery: version, |
223
|
|
|
|
224
|
|
|
constructor: jQuery, |
225
|
|
|
|
226
|
|
|
// The default length of a jQuery object is 0 |
227
|
|
|
length: 0, |
228
|
|
|
|
229
|
|
|
toArray: function() { |
230
|
|
|
return slice.call( this ); |
231
|
|
|
}, |
232
|
|
|
|
233
|
|
|
// Get the Nth element in the matched element set OR |
234
|
|
|
// Get the whole matched element set as a clean array |
235
|
|
|
get: function( num ) { |
236
|
|
|
|
237
|
|
|
// Return all the elements in a clean array |
238
|
|
|
if ( num == null ) { |
239
|
|
|
return slice.call( this ); |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
// Return just the one element from the set |
243
|
|
|
return num < 0 ? this[ num + this.length ] : this[ num ]; |
244
|
|
|
}, |
245
|
|
|
|
246
|
|
|
// Take an array of elements and push it onto the stack |
247
|
|
|
// (returning the new matched element set) |
248
|
|
|
pushStack: function( elems ) { |
249
|
|
|
|
250
|
|
|
// Build a new jQuery matched element set |
251
|
|
|
var ret = jQuery.merge( this.constructor(), elems ); |
252
|
|
|
|
253
|
|
|
// Add the old object onto the stack (as a reference) |
254
|
|
|
ret.prevObject = this; |
255
|
|
|
|
256
|
|
|
// Return the newly-formed element set |
257
|
|
|
return ret; |
258
|
|
|
}, |
259
|
|
|
|
260
|
|
|
// Execute a callback for every element in the matched set. |
261
|
|
|
each: function( callback ) { |
262
|
|
|
return jQuery.each( this, callback ); |
263
|
|
|
}, |
264
|
|
|
|
265
|
|
|
map: function( callback ) { |
266
|
|
|
return this.pushStack( jQuery.map( this, function( elem, i ) { |
267
|
|
|
return callback.call( elem, i, elem ); |
268
|
|
|
} ) ); |
269
|
|
|
}, |
270
|
|
|
|
271
|
|
|
slice: function() { |
272
|
|
|
return this.pushStack( slice.apply( this, arguments ) ); |
273
|
|
|
}, |
274
|
|
|
|
275
|
|
|
first: function() { |
276
|
|
|
return this.eq( 0 ); |
277
|
|
|
}, |
278
|
|
|
|
279
|
|
|
last: function() { |
280
|
|
|
return this.eq( -1 ); |
281
|
|
|
}, |
282
|
|
|
|
283
|
|
|
eq: function( i ) { |
284
|
|
|
var len = this.length, |
285
|
|
|
j = +i + ( i < 0 ? len : 0 ); |
286
|
|
|
return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); |
287
|
|
|
}, |
288
|
|
|
|
289
|
|
|
end: function() { |
290
|
|
|
return this.prevObject || this.constructor(); |
291
|
|
|
}, |
292
|
|
|
|
293
|
|
|
// For internal use only. |
294
|
|
|
// Behaves like an Array's method, not like a jQuery method. |
295
|
|
|
push: push, |
296
|
|
|
sort: arr.sort, |
297
|
|
|
splice: arr.splice |
298
|
|
|
}; |
299
|
|
|
|
300
|
|
|
jQuery.extend = jQuery.fn.extend = function() { |
301
|
|
|
var options, name, src, copy, copyIsArray, clone, |
302
|
|
|
target = arguments[ 0 ] || {}, |
303
|
|
|
i = 1, |
304
|
|
|
length = arguments.length, |
305
|
|
|
deep = false; |
306
|
|
|
|
307
|
|
|
// Handle a deep copy situation |
308
|
|
|
if ( typeof target === "boolean" ) { |
309
|
|
|
deep = target; |
310
|
|
|
|
311
|
|
|
// Skip the boolean and the target |
312
|
|
|
target = arguments[ i ] || {}; |
313
|
|
|
i++; |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
// Handle case when target is a string or something (possible in deep copy) |
317
|
|
|
if ( typeof target !== "object" && !isFunction( target ) ) { |
318
|
|
|
target = {}; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
// Extend jQuery itself if only one argument is passed |
322
|
|
|
if ( i === length ) { |
323
|
|
|
target = this; |
324
|
|
|
i--; |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
for ( ; i < length; i++ ) { |
328
|
|
|
|
329
|
|
|
// Only deal with non-null/undefined values |
330
|
|
|
if ( ( options = arguments[ i ] ) != null ) { |
331
|
|
|
|
332
|
|
|
// Extend the base object |
333
|
|
|
for ( name in options ) { |
334
|
|
|
src = target[ name ]; |
335
|
|
|
copy = options[ name ]; |
336
|
|
|
|
337
|
|
|
// Prevent never-ending loop |
338
|
|
|
if ( target === copy ) { |
339
|
|
|
continue; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
// Recurse if we're merging plain objects or arrays |
343
|
|
|
if ( deep && copy && ( jQuery.isPlainObject( copy ) || |
344
|
|
|
( copyIsArray = Array.isArray( copy ) ) ) ) { |
345
|
|
|
|
346
|
|
|
if ( copyIsArray ) { |
347
|
|
|
copyIsArray = false; |
348
|
|
|
clone = src && Array.isArray( src ) ? src : []; |
349
|
|
|
|
350
|
|
|
} else { |
351
|
|
|
clone = src && jQuery.isPlainObject( src ) ? src : {}; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
// Never move original objects, clone them |
355
|
|
|
target[ name ] = jQuery.extend( deep, clone, copy ); |
356
|
|
|
|
357
|
|
|
// Don't bring in undefined values |
358
|
|
|
} else if ( copy !== undefined ) { |
359
|
|
|
target[ name ] = copy; |
360
|
|
|
} |
361
|
|
|
} |
362
|
|
|
} |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
// Return the modified object |
366
|
|
|
return target; |
367
|
|
|
}; |
368
|
|
|
|
369
|
|
|
jQuery.extend( { |
370
|
|
|
|
371
|
|
|
// Unique for each copy of jQuery on the page |
372
|
|
|
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), |
373
|
|
|
|
374
|
|
|
// Assume jQuery is ready without the ready module |
375
|
|
|
isReady: true, |
376
|
|
|
|
377
|
|
|
error: function( msg ) { |
378
|
|
|
throw new Error( msg ); |
379
|
|
|
}, |
380
|
|
|
|
381
|
|
|
noop: function() {}, |
382
|
|
|
|
383
|
|
|
isPlainObject: function( obj ) { |
384
|
|
|
var proto, Ctor; |
385
|
|
|
|
386
|
|
|
// Detect obvious negatives |
387
|
|
|
// Use toString instead of jQuery.type to catch host objects |
388
|
|
|
if ( !obj || toString.call( obj ) !== "[object Object]" ) { |
389
|
|
|
return false; |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
proto = getProto( obj ); |
393
|
|
|
|
394
|
|
|
// Objects with no prototype (e.g., `Object.create( null )`) are plain |
395
|
|
|
if ( !proto ) { |
396
|
|
|
return true; |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
// Objects with prototype are plain iff they were constructed by a global Object function |
400
|
|
|
Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; |
401
|
|
|
return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; |
402
|
|
|
}, |
403
|
|
|
|
404
|
|
|
isEmptyObject: function( obj ) { |
405
|
|
|
|
406
|
|
|
/* eslint-disable no-unused-vars */ |
407
|
|
|
// See https://github.com/eslint/eslint/issues/6125 |
408
|
|
|
var name; |
409
|
|
|
|
410
|
|
|
for ( name in obj ) { |
411
|
|
|
return false; |
412
|
|
|
} |
413
|
|
|
return true; |
414
|
|
|
}, |
415
|
|
|
|
416
|
|
|
// Evaluates a script in a global context |
417
|
|
|
globalEval: function( code ) { |
418
|
|
|
DOMEval( code ); |
419
|
|
|
}, |
420
|
|
|
|
421
|
|
|
each: function( obj, callback ) { |
422
|
|
|
var length, i = 0; |
423
|
|
|
|
424
|
|
|
if ( isArrayLike( obj ) ) { |
425
|
|
|
length = obj.length; |
426
|
|
|
for ( ; i < length; i++ ) { |
427
|
|
|
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
428
|
|
|
break; |
429
|
|
|
} |
430
|
|
|
} |
431
|
|
|
} else { |
432
|
|
|
for ( i in obj ) { |
433
|
|
|
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
434
|
|
|
break; |
435
|
|
|
} |
436
|
|
|
} |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
return obj; |
440
|
|
|
}, |
441
|
|
|
|
442
|
|
|
// Support: Android <=4.0 only |
443
|
|
|
trim: function( text ) { |
444
|
|
|
return text == null ? |
445
|
|
|
"" : |
446
|
|
|
( text + "" ).replace( rtrim, "" ); |
447
|
|
|
}, |
448
|
|
|
|
449
|
|
|
// results is for internal usage only |
450
|
|
|
makeArray: function( arr, results ) { |
451
|
|
|
var ret = results || []; |
452
|
|
|
|
453
|
|
|
if ( arr != null ) { |
454
|
|
|
if ( isArrayLike( Object( arr ) ) ) { |
455
|
|
|
jQuery.merge( ret, |
456
|
|
|
typeof arr === "string" ? |
457
|
|
|
[ arr ] : arr |
458
|
|
|
); |
459
|
|
|
} else { |
460
|
|
|
push.call( ret, arr ); |
461
|
|
|
} |
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
return ret; |
465
|
|
|
}, |
466
|
|
|
|
467
|
|
|
inArray: function( elem, arr, i ) { |
468
|
|
|
return arr == null ? -1 : indexOf.call( arr, elem, i ); |
469
|
|
|
}, |
470
|
|
|
|
471
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only |
472
|
|
|
// push.apply(_, arraylike) throws on ancient WebKit |
473
|
|
|
merge: function( first, second ) { |
474
|
|
|
var len = +second.length, |
475
|
|
|
j = 0, |
476
|
|
|
i = first.length; |
477
|
|
|
|
478
|
|
|
for ( ; j < len; j++ ) { |
479
|
|
|
first[ i++ ] = second[ j ]; |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
first.length = i; |
483
|
|
|
|
484
|
|
|
return first; |
485
|
|
|
}, |
486
|
|
|
|
487
|
|
|
grep: function( elems, callback, invert ) { |
488
|
|
|
var callbackInverse, |
489
|
|
|
matches = [], |
490
|
|
|
i = 0, |
491
|
|
|
length = elems.length, |
492
|
|
|
callbackExpect = !invert; |
493
|
|
|
|
494
|
|
|
// Go through the array, only saving the items |
495
|
|
|
// that pass the validator function |
496
|
|
|
for ( ; i < length; i++ ) { |
497
|
|
|
callbackInverse = !callback( elems[ i ], i ); |
498
|
|
|
if ( callbackInverse !== callbackExpect ) { |
499
|
|
|
matches.push( elems[ i ] ); |
500
|
|
|
} |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
return matches; |
504
|
|
|
}, |
505
|
|
|
|
506
|
|
|
// arg is for internal usage only |
507
|
|
|
map: function( elems, callback, arg ) { |
508
|
|
|
var length, value, |
509
|
|
|
i = 0, |
510
|
|
|
ret = []; |
511
|
|
|
|
512
|
|
|
// Go through the array, translating each of the items to their new values |
513
|
|
|
if ( isArrayLike( elems ) ) { |
514
|
|
|
length = elems.length; |
515
|
|
|
for ( ; i < length; i++ ) { |
516
|
|
|
value = callback( elems[ i ], i, arg ); |
517
|
|
|
|
518
|
|
|
if ( value != null ) { |
519
|
|
|
ret.push( value ); |
520
|
|
|
} |
521
|
|
|
} |
522
|
|
|
|
523
|
|
|
// Go through every key on the object, |
524
|
|
|
} else { |
525
|
|
|
for ( i in elems ) { |
526
|
|
|
value = callback( elems[ i ], i, arg ); |
527
|
|
|
|
528
|
|
|
if ( value != null ) { |
529
|
|
|
ret.push( value ); |
530
|
|
|
} |
531
|
|
|
} |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
// Flatten any nested arrays |
535
|
|
|
return concat.apply( [], ret ); |
536
|
|
|
}, |
537
|
|
|
|
538
|
|
|
// A global GUID counter for objects |
539
|
|
|
guid: 1, |
540
|
|
|
|
541
|
|
|
// jQuery.support is not used in Core but other projects attach their |
542
|
|
|
// properties to it so it needs to exist. |
543
|
|
|
support: support |
544
|
|
|
} ); |
545
|
|
|
|
546
|
|
|
if ( typeof Symbol === "function" ) { |
547
|
|
|
jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; |
548
|
|
|
} |
549
|
|
|
|
550
|
|
|
// Populate the class2type map |
551
|
|
|
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), |
552
|
|
|
function( i, name ) { |
553
|
|
|
class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
554
|
|
|
} ); |
555
|
|
|
|
556
|
|
|
function isArrayLike( obj ) { |
557
|
|
|
|
558
|
|
|
// Support: real iOS 8.2 only (not reproducible in simulator) |
559
|
|
|
// `in` check used to prevent JIT error (gh-2145) |
560
|
|
|
// hasOwn isn't used here due to false negatives |
561
|
|
|
// regarding Nodelist length in IE |
562
|
|
|
var length = !!obj && "length" in obj && obj.length, |
563
|
|
|
type = toType( obj ); |
564
|
|
|
|
565
|
|
|
if ( isFunction( obj ) || isWindow( obj ) ) { |
566
|
|
|
return false; |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
return type === "array" || length === 0 || |
570
|
|
|
typeof length === "number" && length > 0 && ( length - 1 ) in obj; |
571
|
|
|
} |
572
|
|
|
var Sizzle = |
573
|
|
|
/*! |
574
|
|
|
* Sizzle CSS Selector Engine v2.3.3 |
575
|
|
|
* https://sizzlejs.com/ |
576
|
|
|
* |
577
|
|
|
* Copyright jQuery Foundation and other contributors |
578
|
|
|
* Released under the MIT license |
579
|
|
|
* http://jquery.org/license |
580
|
|
|
* |
581
|
|
|
* Date: 2016-08-08 |
582
|
|
|
*/ |
583
|
|
|
(function( window ) { |
584
|
|
|
|
585
|
|
|
var i, |
586
|
|
|
support, |
587
|
|
|
Expr, |
588
|
|
|
getText, |
589
|
|
|
isXML, |
590
|
|
|
tokenize, |
591
|
|
|
compile, |
592
|
|
|
select, |
593
|
|
|
outermostContext, |
594
|
|
|
sortInput, |
595
|
|
|
hasDuplicate, |
596
|
|
|
|
597
|
|
|
// Local document vars |
598
|
|
|
setDocument, |
599
|
|
|
document, |
600
|
|
|
docElem, |
601
|
|
|
documentIsHTML, |
602
|
|
|
rbuggyQSA, |
603
|
|
|
rbuggyMatches, |
604
|
|
|
matches, |
605
|
|
|
contains, |
606
|
|
|
|
607
|
|
|
// Instance-specific data |
608
|
|
|
expando = "sizzle" + 1 * new Date(), |
609
|
|
|
preferredDoc = window.document, |
610
|
|
|
dirruns = 0, |
611
|
|
|
done = 0, |
612
|
|
|
classCache = createCache(), |
613
|
|
|
tokenCache = createCache(), |
614
|
|
|
compilerCache = createCache(), |
615
|
|
|
sortOrder = function( a, b ) { |
616
|
|
|
if ( a === b ) { |
617
|
|
|
hasDuplicate = true; |
618
|
|
|
} |
619
|
|
|
return 0; |
620
|
|
|
}, |
621
|
|
|
|
622
|
|
|
// Instance methods |
623
|
|
|
hasOwn = ({}).hasOwnProperty, |
624
|
|
|
arr = [], |
625
|
|
|
pop = arr.pop, |
626
|
|
|
push_native = arr.push, |
627
|
|
|
push = arr.push, |
628
|
|
|
slice = arr.slice, |
629
|
|
|
// Use a stripped-down indexOf as it's faster than native |
630
|
|
|
// https://jsperf.com/thor-indexof-vs-for/5 |
631
|
|
|
indexOf = function( list, elem ) { |
632
|
|
|
var i = 0, |
633
|
|
|
len = list.length; |
634
|
|
|
for ( ; i < len; i++ ) { |
635
|
|
|
if ( list[i] === elem ) { |
636
|
|
|
return i; |
637
|
|
|
} |
638
|
|
|
} |
639
|
|
|
return -1; |
640
|
|
|
}, |
641
|
|
|
|
642
|
|
|
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", |
643
|
|
|
|
644
|
|
|
// Regular expressions |
645
|
|
|
|
646
|
|
|
// http://www.w3.org/TR/css3-selectors/#whitespace |
647
|
|
|
whitespace = "[\\x20\\t\\r\\n\\f]", |
648
|
|
|
|
649
|
|
|
// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier |
650
|
|
|
identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", |
651
|
|
|
|
652
|
|
|
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors |
653
|
|
|
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + |
654
|
|
|
// Operator (capture 2) |
655
|
|
|
"*([*^$|!~]?=)" + whitespace + |
656
|
|
|
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" |
657
|
|
|
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + |
658
|
|
|
"*\\]", |
659
|
|
|
|
660
|
|
|
pseudos = ":(" + identifier + ")(?:\\((" + |
661
|
|
|
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: |
662
|
|
|
// 1. quoted (capture 3; capture 4 or capture 5) |
663
|
|
|
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + |
664
|
|
|
// 2. simple (capture 6) |
665
|
|
|
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + |
666
|
|
|
// 3. anything else (capture 2) |
667
|
|
|
".*" + |
668
|
|
|
")\\)|)", |
669
|
|
|
|
670
|
|
|
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
671
|
|
|
rwhitespace = new RegExp( whitespace + "+", "g" ), |
672
|
|
|
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), |
673
|
|
|
|
674
|
|
|
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
675
|
|
|
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), |
676
|
|
|
|
677
|
|
|
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), |
678
|
|
|
|
679
|
|
|
rpseudo = new RegExp( pseudos ), |
680
|
|
|
ridentifier = new RegExp( "^" + identifier + "$" ), |
681
|
|
|
|
682
|
|
|
matchExpr = { |
683
|
|
|
"ID": new RegExp( "^#(" + identifier + ")" ), |
684
|
|
|
"CLASS": new RegExp( "^\\.(" + identifier + ")" ), |
685
|
|
|
"TAG": new RegExp( "^(" + identifier + "|[*])" ), |
686
|
|
|
"ATTR": new RegExp( "^" + attributes ), |
687
|
|
|
"PSEUDO": new RegExp( "^" + pseudos ), |
688
|
|
|
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + |
689
|
|
|
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + |
690
|
|
|
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
691
|
|
|
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ), |
692
|
|
|
// For use in libraries implementing .is() |
693
|
|
|
// We use this for POS matching in `select` |
694
|
|
|
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + |
695
|
|
|
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) |
696
|
|
|
}, |
697
|
|
|
|
698
|
|
|
rinputs = /^(?:input|select|textarea|button)$/i, |
699
|
|
|
rheader = /^h\d$/i, |
700
|
|
|
|
701
|
|
|
rnative = /^[^{]+\{\s*\[native \w/, |
702
|
|
|
|
703
|
|
|
// Easily-parseable/retrievable ID or TAG or CLASS selectors |
704
|
|
|
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
705
|
|
|
|
706
|
|
|
rsibling = /[+~]/, |
707
|
|
|
|
708
|
|
|
// CSS escapes |
709
|
|
|
// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
710
|
|
|
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), |
711
|
|
|
funescape = function( _, escaped, escapedWhitespace ) { |
712
|
|
|
var high = "0x" + escaped - 0x10000; |
713
|
|
|
// NaN means non-codepoint |
714
|
|
|
// Support: Firefox<24 |
715
|
|
|
// Workaround erroneous numeric interpretation of +"0x" |
716
|
|
|
return high !== high || escapedWhitespace ? |
717
|
|
|
escaped : |
718
|
|
|
high < 0 ? |
719
|
|
|
// BMP codepoint |
720
|
|
|
String.fromCharCode( high + 0x10000 ) : |
721
|
|
|
// Supplemental Plane codepoint (surrogate pair) |
722
|
|
|
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
723
|
|
|
}, |
724
|
|
|
|
725
|
|
|
// CSS string/identifier serialization |
726
|
|
|
// https://drafts.csswg.org/cssom/#common-serializing-idioms |
727
|
|
|
rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, |
728
|
|
|
fcssescape = function( ch, asCodePoint ) { |
729
|
|
|
if ( asCodePoint ) { |
730
|
|
|
|
731
|
|
|
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER |
732
|
|
|
if ( ch === "\0" ) { |
733
|
|
|
return "\uFFFD"; |
734
|
|
|
} |
735
|
|
|
|
736
|
|
|
// Control characters and (dependent upon position) numbers get escaped as code points |
737
|
|
|
return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; |
738
|
|
|
} |
739
|
|
|
|
740
|
|
|
// Other potentially-special ASCII characters get backslash-escaped |
741
|
|
|
return "\\" + ch; |
742
|
|
|
}, |
743
|
|
|
|
744
|
|
|
// Used for iframes |
745
|
|
|
// See setDocument() |
746
|
|
|
// Removing the function wrapper causes a "Permission Denied" |
747
|
|
|
// error in IE |
748
|
|
|
unloadHandler = function() { |
749
|
|
|
setDocument(); |
750
|
|
|
}, |
751
|
|
|
|
752
|
|
|
disabledAncestor = addCombinator( |
753
|
|
|
function( elem ) { |
754
|
|
|
return elem.disabled === true && ("form" in elem || "label" in elem); |
755
|
|
|
}, |
756
|
|
|
{ dir: "parentNode", next: "legend" } |
757
|
|
|
); |
758
|
|
|
|
759
|
|
|
// Optimize for push.apply( _, NodeList ) |
760
|
|
|
try { |
761
|
|
|
push.apply( |
762
|
|
|
(arr = slice.call( preferredDoc.childNodes )), |
763
|
|
|
preferredDoc.childNodes |
764
|
|
|
); |
765
|
|
|
// Support: Android<4.0 |
766
|
|
|
// Detect silently failing push.apply |
767
|
|
|
arr[ preferredDoc.childNodes.length ].nodeType; |
768
|
|
|
} catch ( e ) { |
769
|
|
|
push = { apply: arr.length ? |
770
|
|
|
|
771
|
|
|
// Leverage slice if possible |
772
|
|
|
function( target, els ) { |
773
|
|
|
push_native.apply( target, slice.call(els) ); |
774
|
|
|
} : |
775
|
|
|
|
776
|
|
|
// Support: IE<9 |
777
|
|
|
// Otherwise append directly |
778
|
|
|
function( target, els ) { |
779
|
|
|
var j = target.length, |
780
|
|
|
i = 0; |
781
|
|
|
// Can't trust NodeList.length |
782
|
|
|
while ( (target[j++] = els[i++]) ) {} |
783
|
|
|
target.length = j - 1; |
784
|
|
|
} |
785
|
|
|
}; |
786
|
|
|
} |
787
|
|
|
|
788
|
|
|
function Sizzle( selector, context, results, seed ) { |
789
|
|
|
var m, i, elem, nid, match, groups, newSelector, |
790
|
|
|
newContext = context && context.ownerDocument, |
791
|
|
|
|
792
|
|
|
// nodeType defaults to 9, since context defaults to document |
793
|
|
|
nodeType = context ? context.nodeType : 9; |
794
|
|
|
|
795
|
|
|
results = results || []; |
796
|
|
|
|
797
|
|
|
// Return early from calls with invalid selector or context |
798
|
|
|
if ( typeof selector !== "string" || !selector || |
799
|
|
|
nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { |
800
|
|
|
|
801
|
|
|
return results; |
802
|
|
|
} |
803
|
|
|
|
804
|
|
|
// Try to shortcut find operations (as opposed to filters) in HTML documents |
805
|
|
|
if ( !seed ) { |
806
|
|
|
|
807
|
|
|
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { |
808
|
|
|
setDocument( context ); |
809
|
|
|
} |
810
|
|
|
context = context || document; |
811
|
|
|
|
812
|
|
|
if ( documentIsHTML ) { |
813
|
|
|
|
814
|
|
|
// If the selector is sufficiently simple, try using a "get*By*" DOM method |
815
|
|
|
// (excepting DocumentFragment context, where the methods don't exist) |
816
|
|
|
if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { |
817
|
|
|
|
818
|
|
|
// ID selector |
819
|
|
|
if ( (m = match[1]) ) { |
820
|
|
|
|
821
|
|
|
// Document context |
822
|
|
|
if ( nodeType === 9 ) { |
823
|
|
|
if ( (elem = context.getElementById( m )) ) { |
824
|
|
|
|
825
|
|
|
// Support: IE, Opera, Webkit |
826
|
|
|
// TODO: identify versions |
827
|
|
|
// getElementById can match elements by name instead of ID |
828
|
|
|
if ( elem.id === m ) { |
829
|
|
|
results.push( elem ); |
830
|
|
|
return results; |
831
|
|
|
} |
832
|
|
|
} else { |
833
|
|
|
return results; |
834
|
|
|
} |
835
|
|
|
|
836
|
|
|
// Element context |
837
|
|
|
} else { |
838
|
|
|
|
839
|
|
|
// Support: IE, Opera, Webkit |
840
|
|
|
// TODO: identify versions |
841
|
|
|
// getElementById can match elements by name instead of ID |
842
|
|
|
if ( newContext && (elem = newContext.getElementById( m )) && |
843
|
|
|
contains( context, elem ) && |
844
|
|
|
elem.id === m ) { |
845
|
|
|
|
846
|
|
|
results.push( elem ); |
847
|
|
|
return results; |
848
|
|
|
} |
849
|
|
|
} |
850
|
|
|
|
851
|
|
|
// Type selector |
852
|
|
|
} else if ( match[2] ) { |
853
|
|
|
push.apply( results, context.getElementsByTagName( selector ) ); |
854
|
|
|
return results; |
855
|
|
|
|
856
|
|
|
// Class selector |
857
|
|
|
} else if ( (m = match[3]) && support.getElementsByClassName && |
858
|
|
|
context.getElementsByClassName ) { |
859
|
|
|
|
860
|
|
|
push.apply( results, context.getElementsByClassName( m ) ); |
861
|
|
|
return results; |
862
|
|
|
} |
863
|
|
|
} |
864
|
|
|
|
865
|
|
|
// Take advantage of querySelectorAll |
866
|
|
|
if ( support.qsa && |
867
|
|
|
!compilerCache[ selector + " " ] && |
868
|
|
|
(!rbuggyQSA || !rbuggyQSA.test( selector )) ) { |
869
|
|
|
|
870
|
|
|
if ( nodeType !== 1 ) { |
871
|
|
|
newContext = context; |
872
|
|
|
newSelector = selector; |
873
|
|
|
|
874
|
|
|
// qSA looks outside Element context, which is not what we want |
875
|
|
|
// Thanks to Andrew Dupont for this workaround technique |
876
|
|
|
// Support: IE <=8 |
877
|
|
|
// Exclude object elements |
878
|
|
|
} else if ( context.nodeName.toLowerCase() !== "object" ) { |
879
|
|
|
|
880
|
|
|
// Capture the context ID, setting it first if necessary |
881
|
|
|
if ( (nid = context.getAttribute( "id" )) ) { |
882
|
|
|
nid = nid.replace( rcssescape, fcssescape ); |
883
|
|
|
} else { |
884
|
|
|
context.setAttribute( "id", (nid = expando) ); |
885
|
|
|
} |
886
|
|
|
|
887
|
|
|
// Prefix every selector in the list |
888
|
|
|
groups = tokenize( selector ); |
889
|
|
|
i = groups.length; |
890
|
|
|
while ( i-- ) { |
891
|
|
|
groups[i] = "#" + nid + " " + toSelector( groups[i] ); |
892
|
|
|
} |
893
|
|
|
newSelector = groups.join( "," ); |
894
|
|
|
|
895
|
|
|
// Expand context for sibling selectors |
896
|
|
|
newContext = rsibling.test( selector ) && testContext( context.parentNode ) || |
897
|
|
|
context; |
898
|
|
|
} |
899
|
|
|
|
900
|
|
|
if ( newSelector ) { |
901
|
|
|
try { |
902
|
|
|
push.apply( results, |
903
|
|
|
newContext.querySelectorAll( newSelector ) |
904
|
|
|
); |
905
|
|
|
return results; |
906
|
|
|
} catch ( qsaError ) { |
907
|
|
|
} finally { |
908
|
|
|
if ( nid === expando ) { |
909
|
|
|
context.removeAttribute( "id" ); |
910
|
|
|
} |
911
|
|
|
} |
912
|
|
|
} |
913
|
|
|
} |
914
|
|
|
} |
915
|
|
|
} |
916
|
|
|
|
917
|
|
|
// All others |
918
|
|
|
return select( selector.replace( rtrim, "$1" ), context, results, seed ); |
919
|
|
|
} |
920
|
|
|
|
921
|
|
|
/** |
922
|
|
|
* Create key-value caches of limited size |
923
|
|
|
* @returns {function(string, object)} Returns the Object data after storing it on itself with |
924
|
|
|
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) |
925
|
|
|
* deleting the oldest entry |
926
|
|
|
*/ |
927
|
|
|
function createCache() { |
928
|
|
|
var keys = []; |
929
|
|
|
|
930
|
|
|
function cache( key, value ) { |
931
|
|
|
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
932
|
|
|
if ( keys.push( key + " " ) > Expr.cacheLength ) { |
933
|
|
|
// Only keep the most recent entries |
934
|
|
|
delete cache[ keys.shift() ]; |
935
|
|
|
} |
936
|
|
|
return (cache[ key + " " ] = value); |
937
|
|
|
} |
938
|
|
|
return cache; |
939
|
|
|
} |
940
|
|
|
|
941
|
|
|
/** |
942
|
|
|
* Mark a function for special use by Sizzle |
943
|
|
|
* @param {Function} fn The function to mark |
944
|
|
|
*/ |
945
|
|
|
function markFunction( fn ) { |
946
|
|
|
fn[ expando ] = true; |
947
|
|
|
return fn; |
948
|
|
|
} |
949
|
|
|
|
950
|
|
|
/** |
951
|
|
|
* Support testing using an element |
952
|
|
|
* @param {Function} fn Passed the created element and returns a boolean result |
953
|
|
|
*/ |
954
|
|
|
function assert( fn ) { |
955
|
|
|
var el = document.createElement("fieldset"); |
956
|
|
|
|
957
|
|
|
try { |
958
|
|
|
return !!fn( el ); |
959
|
|
|
} catch (e) { |
960
|
|
|
return false; |
961
|
|
|
} finally { |
962
|
|
|
// Remove from its parent by default |
963
|
|
|
if ( el.parentNode ) { |
964
|
|
|
el.parentNode.removeChild( el ); |
965
|
|
|
} |
966
|
|
|
// release memory in IE |
967
|
|
|
el = null; |
968
|
|
|
} |
969
|
|
|
} |
970
|
|
|
|
971
|
|
|
/** |
972
|
|
|
* Adds the same handler for all of the specified attrs |
973
|
|
|
* @param {String} attrs Pipe-separated list of attributes |
974
|
|
|
* @param {Function} handler The method that will be applied |
975
|
|
|
*/ |
976
|
|
|
function addHandle( attrs, handler ) { |
977
|
|
|
var arr = attrs.split("|"), |
978
|
|
|
i = arr.length; |
979
|
|
|
|
980
|
|
|
while ( i-- ) { |
981
|
|
|
Expr.attrHandle[ arr[i] ] = handler; |
982
|
|
|
} |
983
|
|
|
} |
984
|
|
|
|
985
|
|
|
/** |
986
|
|
|
* Checks document order of two siblings |
987
|
|
|
* @param {Element} a |
988
|
|
|
* @param {Element} b |
989
|
|
|
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b |
990
|
|
|
*/ |
991
|
|
|
function siblingCheck( a, b ) { |
992
|
|
|
var cur = b && a, |
993
|
|
|
diff = cur && a.nodeType === 1 && b.nodeType === 1 && |
994
|
|
|
a.sourceIndex - b.sourceIndex; |
995
|
|
|
|
996
|
|
|
// Use IE sourceIndex if available on both nodes |
997
|
|
|
if ( diff ) { |
998
|
|
|
return diff; |
999
|
|
|
} |
1000
|
|
|
|
1001
|
|
|
// Check if b follows a |
1002
|
|
|
if ( cur ) { |
1003
|
|
|
while ( (cur = cur.nextSibling) ) { |
1004
|
|
|
if ( cur === b ) { |
1005
|
|
|
return -1; |
1006
|
|
|
} |
1007
|
|
|
} |
1008
|
|
|
} |
1009
|
|
|
|
1010
|
|
|
return a ? 1 : -1; |
1011
|
|
|
} |
1012
|
|
|
|
1013
|
|
|
/** |
1014
|
|
|
* Returns a function to use in pseudos for input types |
1015
|
|
|
* @param {String} type |
1016
|
|
|
*/ |
1017
|
|
|
function createInputPseudo( type ) { |
1018
|
|
|
return function( elem ) { |
1019
|
|
|
var name = elem.nodeName.toLowerCase(); |
1020
|
|
|
return name === "input" && elem.type === type; |
1021
|
|
|
}; |
1022
|
|
|
} |
1023
|
|
|
|
1024
|
|
|
/** |
1025
|
|
|
* Returns a function to use in pseudos for buttons |
1026
|
|
|
* @param {String} type |
1027
|
|
|
*/ |
1028
|
|
|
function createButtonPseudo( type ) { |
1029
|
|
|
return function( elem ) { |
1030
|
|
|
var name = elem.nodeName.toLowerCase(); |
1031
|
|
|
return (name === "input" || name === "button") && elem.type === type; |
1032
|
|
|
}; |
1033
|
|
|
} |
1034
|
|
|
|
1035
|
|
|
/** |
1036
|
|
|
* Returns a function to use in pseudos for :enabled/:disabled |
1037
|
|
|
* @param {Boolean} disabled true for :disabled; false for :enabled |
1038
|
|
|
*/ |
1039
|
|
|
function createDisabledPseudo( disabled ) { |
1040
|
|
|
|
1041
|
|
|
// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable |
1042
|
|
|
return function( elem ) { |
1043
|
|
|
|
1044
|
|
|
// Only certain elements can match :enabled or :disabled |
1045
|
|
|
// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled |
1046
|
|
|
// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled |
1047
|
|
|
if ( "form" in elem ) { |
1048
|
|
|
|
1049
|
|
|
// Check for inherited disabledness on relevant non-disabled elements: |
1050
|
|
|
// * listed form-associated elements in a disabled fieldset |
1051
|
|
|
// https://html.spec.whatwg.org/multipage/forms.html#category-listed |
1052
|
|
|
// https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled |
1053
|
|
|
// * option elements in a disabled optgroup |
1054
|
|
|
// https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled |
1055
|
|
|
// All such elements have a "form" property. |
1056
|
|
|
if ( elem.parentNode && elem.disabled === false ) { |
1057
|
|
|
|
1058
|
|
|
// Option elements defer to a parent optgroup if present |
1059
|
|
|
if ( "label" in elem ) { |
1060
|
|
|
if ( "label" in elem.parentNode ) { |
1061
|
|
|
return elem.parentNode.disabled === disabled; |
1062
|
|
|
} else { |
1063
|
|
|
return elem.disabled === disabled; |
1064
|
|
|
} |
1065
|
|
|
} |
1066
|
|
|
|
1067
|
|
|
// Support: IE 6 - 11 |
1068
|
|
|
// Use the isDisabled shortcut property to check for disabled fieldset ancestors |
1069
|
|
|
return elem.isDisabled === disabled || |
1070
|
|
|
|
1071
|
|
|
// Where there is no isDisabled, check manually |
1072
|
|
|
/* jshint -W018 */ |
1073
|
|
|
elem.isDisabled !== !disabled && |
1074
|
|
|
disabledAncestor( elem ) === disabled; |
1075
|
|
|
} |
1076
|
|
|
|
1077
|
|
|
return elem.disabled === disabled; |
1078
|
|
|
|
1079
|
|
|
// Try to winnow out elements that can't be disabled before trusting the disabled property. |
1080
|
|
|
// Some victims get caught in our net (label, legend, menu, track), but it shouldn't |
1081
|
|
|
// even exist on them, let alone have a boolean value. |
1082
|
|
|
} else if ( "label" in elem ) { |
1083
|
|
|
return elem.disabled === disabled; |
1084
|
|
|
} |
1085
|
|
|
|
1086
|
|
|
// Remaining elements are neither :enabled nor :disabled |
1087
|
|
|
return false; |
1088
|
|
|
}; |
1089
|
|
|
} |
1090
|
|
|
|
1091
|
|
|
/** |
1092
|
|
|
* Returns a function to use in pseudos for positionals |
1093
|
|
|
* @param {Function} fn |
1094
|
|
|
*/ |
1095
|
|
|
function createPositionalPseudo( fn ) { |
1096
|
|
|
return markFunction(function( argument ) { |
1097
|
|
|
argument = +argument; |
1098
|
|
|
return markFunction(function( seed, matches ) { |
1099
|
|
|
var j, |
1100
|
|
|
matchIndexes = fn( [], seed.length, argument ), |
1101
|
|
|
i = matchIndexes.length; |
1102
|
|
|
|
1103
|
|
|
// Match elements found at the specified indexes |
1104
|
|
|
while ( i-- ) { |
1105
|
|
|
if ( seed[ (j = matchIndexes[i]) ] ) { |
1106
|
|
|
seed[j] = !(matches[j] = seed[j]); |
1107
|
|
|
} |
1108
|
|
|
} |
1109
|
|
|
}); |
1110
|
|
|
}); |
1111
|
|
|
} |
1112
|
|
|
|
1113
|
|
|
/** |
1114
|
|
|
* Checks a node for validity as a Sizzle context |
1115
|
|
|
* @param {Element|Object=} context |
1116
|
|
|
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
1117
|
|
|
*/ |
1118
|
|
|
function testContext( context ) { |
1119
|
|
|
return context && typeof context.getElementsByTagName !== "undefined" && context; |
1120
|
|
|
} |
1121
|
|
|
|
1122
|
|
|
// Expose support vars for convenience |
1123
|
|
|
support = Sizzle.support = {}; |
1124
|
|
|
|
1125
|
|
|
/** |
1126
|
|
|
* Detects XML nodes |
1127
|
|
|
* @param {Element|Object} elem An element or a document |
1128
|
|
|
* @returns {Boolean} True iff elem is a non-HTML XML node |
1129
|
|
|
*/ |
1130
|
|
|
isXML = Sizzle.isXML = function( elem ) { |
1131
|
|
|
// documentElement is verified for cases where it doesn't yet exist |
1132
|
|
|
// (such as loading iframes in IE - #4833) |
1133
|
|
|
var documentElement = elem && (elem.ownerDocument || elem).documentElement; |
1134
|
|
|
return documentElement ? documentElement.nodeName !== "HTML" : false; |
1135
|
|
|
}; |
1136
|
|
|
|
1137
|
|
|
/** |
1138
|
|
|
* Sets document-related variables once based on the current document |
1139
|
|
|
* @param {Element|Object} [doc] An element or document object to use to set the document |
1140
|
|
|
* @returns {Object} Returns the current document |
1141
|
|
|
*/ |
1142
|
|
|
setDocument = Sizzle.setDocument = function( node ) { |
1143
|
|
|
var hasCompare, subWindow, |
1144
|
|
|
doc = node ? node.ownerDocument || node : preferredDoc; |
1145
|
|
|
|
1146
|
|
|
// Return early if doc is invalid or already selected |
1147
|
|
|
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { |
1148
|
|
|
return document; |
1149
|
|
|
} |
1150
|
|
|
|
1151
|
|
|
// Update global variables |
1152
|
|
|
document = doc; |
1153
|
|
|
docElem = document.documentElement; |
1154
|
|
|
documentIsHTML = !isXML( document ); |
1155
|
|
|
|
1156
|
|
|
// Support: IE 9-11, Edge |
1157
|
|
|
// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) |
1158
|
|
|
if ( preferredDoc !== document && |
1159
|
|
|
(subWindow = document.defaultView) && subWindow.top !== subWindow ) { |
1160
|
|
|
|
1161
|
|
|
// Support: IE 11, Edge |
1162
|
|
|
if ( subWindow.addEventListener ) { |
1163
|
|
|
subWindow.addEventListener( "unload", unloadHandler, false ); |
1164
|
|
|
|
1165
|
|
|
// Support: IE 9 - 10 only |
1166
|
|
|
} else if ( subWindow.attachEvent ) { |
1167
|
|
|
subWindow.attachEvent( "onunload", unloadHandler ); |
1168
|
|
|
} |
1169
|
|
|
} |
1170
|
|
|
|
1171
|
|
|
/* Attributes |
1172
|
|
|
---------------------------------------------------------------------- */ |
1173
|
|
|
|
1174
|
|
|
// Support: IE<8 |
1175
|
|
|
// Verify that getAttribute really returns attributes and not properties |
1176
|
|
|
// (excepting IE8 booleans) |
1177
|
|
|
support.attributes = assert(function( el ) { |
1178
|
|
|
el.className = "i"; |
1179
|
|
|
return !el.getAttribute("className"); |
1180
|
|
|
}); |
1181
|
|
|
|
1182
|
|
|
/* getElement(s)By* |
1183
|
|
|
---------------------------------------------------------------------- */ |
1184
|
|
|
|
1185
|
|
|
// Check if getElementsByTagName("*") returns only elements |
1186
|
|
|
support.getElementsByTagName = assert(function( el ) { |
1187
|
|
|
el.appendChild( document.createComment("") ); |
1188
|
|
|
return !el.getElementsByTagName("*").length; |
1189
|
|
|
}); |
1190
|
|
|
|
1191
|
|
|
// Support: IE<9 |
1192
|
|
|
support.getElementsByClassName = rnative.test( document.getElementsByClassName ); |
1193
|
|
|
|
1194
|
|
|
// Support: IE<10 |
1195
|
|
|
// Check if getElementById returns elements by name |
1196
|
|
|
// The broken getElementById methods don't pick up programmatically-set names, |
1197
|
|
|
// so use a roundabout getElementsByName test |
1198
|
|
|
support.getById = assert(function( el ) { |
1199
|
|
|
docElem.appendChild( el ).id = expando; |
1200
|
|
|
return !document.getElementsByName || !document.getElementsByName( expando ).length; |
1201
|
|
|
}); |
1202
|
|
|
|
1203
|
|
|
// ID filter and find |
1204
|
|
|
if ( support.getById ) { |
1205
|
|
|
Expr.filter["ID"] = function( id ) { |
1206
|
|
|
var attrId = id.replace( runescape, funescape ); |
1207
|
|
|
return function( elem ) { |
1208
|
|
|
return elem.getAttribute("id") === attrId; |
1209
|
|
|
}; |
1210
|
|
|
}; |
1211
|
|
|
Expr.find["ID"] = function( id, context ) { |
1212
|
|
|
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1213
|
|
|
var elem = context.getElementById( id ); |
1214
|
|
|
return elem ? [ elem ] : []; |
1215
|
|
|
} |
1216
|
|
|
}; |
1217
|
|
|
} else { |
1218
|
|
|
Expr.filter["ID"] = function( id ) { |
1219
|
|
|
var attrId = id.replace( runescape, funescape ); |
1220
|
|
|
return function( elem ) { |
1221
|
|
|
var node = typeof elem.getAttributeNode !== "undefined" && |
1222
|
|
|
elem.getAttributeNode("id"); |
1223
|
|
|
return node && node.value === attrId; |
1224
|
|
|
}; |
1225
|
|
|
}; |
1226
|
|
|
|
1227
|
|
|
// Support: IE 6 - 7 only |
1228
|
|
|
// getElementById is not reliable as a find shortcut |
1229
|
|
|
Expr.find["ID"] = function( id, context ) { |
1230
|
|
|
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1231
|
|
|
var node, i, elems, |
1232
|
|
|
elem = context.getElementById( id ); |
1233
|
|
|
|
1234
|
|
|
if ( elem ) { |
1235
|
|
|
|
1236
|
|
|
// Verify the id attribute |
1237
|
|
|
node = elem.getAttributeNode("id"); |
1238
|
|
|
if ( node && node.value === id ) { |
1239
|
|
|
return [ elem ]; |
1240
|
|
|
} |
1241
|
|
|
|
1242
|
|
|
// Fall back on getElementsByName |
1243
|
|
|
elems = context.getElementsByName( id ); |
1244
|
|
|
i = 0; |
1245
|
|
|
while ( (elem = elems[i++]) ) { |
1246
|
|
|
node = elem.getAttributeNode("id"); |
1247
|
|
|
if ( node && node.value === id ) { |
1248
|
|
|
return [ elem ]; |
1249
|
|
|
} |
1250
|
|
|
} |
1251
|
|
|
} |
1252
|
|
|
|
1253
|
|
|
return []; |
1254
|
|
|
} |
1255
|
|
|
}; |
1256
|
|
|
} |
1257
|
|
|
|
1258
|
|
|
// Tag |
1259
|
|
|
Expr.find["TAG"] = support.getElementsByTagName ? |
1260
|
|
|
function( tag, context ) { |
1261
|
|
|
if ( typeof context.getElementsByTagName !== "undefined" ) { |
1262
|
|
|
return context.getElementsByTagName( tag ); |
1263
|
|
|
|
1264
|
|
|
// DocumentFragment nodes don't have gEBTN |
1265
|
|
|
} else if ( support.qsa ) { |
1266
|
|
|
return context.querySelectorAll( tag ); |
1267
|
|
|
} |
1268
|
|
|
} : |
1269
|
|
|
|
1270
|
|
|
function( tag, context ) { |
1271
|
|
|
var elem, |
1272
|
|
|
tmp = [], |
1273
|
|
|
i = 0, |
1274
|
|
|
// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too |
1275
|
|
|
results = context.getElementsByTagName( tag ); |
1276
|
|
|
|
1277
|
|
|
// Filter out possible comments |
1278
|
|
|
if ( tag === "*" ) { |
1279
|
|
|
while ( (elem = results[i++]) ) { |
1280
|
|
|
if ( elem.nodeType === 1 ) { |
1281
|
|
|
tmp.push( elem ); |
1282
|
|
|
} |
1283
|
|
|
} |
1284
|
|
|
|
1285
|
|
|
return tmp; |
1286
|
|
|
} |
1287
|
|
|
return results; |
1288
|
|
|
}; |
1289
|
|
|
|
1290
|
|
|
// Class |
1291
|
|
|
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { |
1292
|
|
|
if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
1293
|
|
|
return context.getElementsByClassName( className ); |
1294
|
|
|
} |
1295
|
|
|
}; |
1296
|
|
|
|
1297
|
|
|
/* QSA/matchesSelector |
1298
|
|
|
---------------------------------------------------------------------- */ |
1299
|
|
|
|
1300
|
|
|
// QSA and matchesSelector support |
1301
|
|
|
|
1302
|
|
|
// matchesSelector(:active) reports false when true (IE9/Opera 11.5) |
1303
|
|
|
rbuggyMatches = []; |
1304
|
|
|
|
1305
|
|
|
// qSa(:focus) reports false when true (Chrome 21) |
1306
|
|
|
// We allow this because of a bug in IE8/9 that throws an error |
1307
|
|
|
// whenever `document.activeElement` is accessed on an iframe |
1308
|
|
|
// So, we allow :focus to pass through QSA all the time to avoid the IE error |
1309
|
|
|
// See https://bugs.jquery.com/ticket/13378 |
1310
|
|
|
rbuggyQSA = []; |
1311
|
|
|
|
1312
|
|
|
if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { |
1313
|
|
|
// Build QSA regex |
1314
|
|
|
// Regex strategy adopted from Diego Perini |
1315
|
|
|
assert(function( el ) { |
1316
|
|
|
// Select is set to empty string on purpose |
1317
|
|
|
// This is to test IE's treatment of not explicitly |
1318
|
|
|
// setting a boolean content attribute, |
1319
|
|
|
// since its presence should be enough |
1320
|
|
|
// https://bugs.jquery.com/ticket/12359 |
1321
|
|
|
docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + |
1322
|
|
|
"<select id='" + expando + "-\r\\' msallowcapture=''>" + |
1323
|
|
|
"<option selected=''></option></select>"; |
1324
|
|
|
|
1325
|
|
|
// Support: IE8, Opera 11-12.16 |
1326
|
|
|
// Nothing should be selected when empty strings follow ^= or $= or *= |
1327
|
|
|
// The test attribute must be unknown in Opera but "safe" for WinRT |
1328
|
|
|
// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
1329
|
|
|
if ( el.querySelectorAll("[msallowcapture^='']").length ) { |
1330
|
|
|
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); |
1331
|
|
|
} |
1332
|
|
|
|
1333
|
|
|
// Support: IE8 |
1334
|
|
|
// Boolean attributes and "value" are not treated correctly |
1335
|
|
|
if ( !el.querySelectorAll("[selected]").length ) { |
1336
|
|
|
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
1337
|
|
|
} |
1338
|
|
|
|
1339
|
|
|
// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ |
1340
|
|
|
if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
1341
|
|
|
rbuggyQSA.push("~="); |
1342
|
|
|
} |
1343
|
|
|
|
1344
|
|
|
// Webkit/Opera - :checked should return selected option elements |
1345
|
|
|
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
1346
|
|
|
// IE8 throws error here and will not see later tests |
1347
|
|
|
if ( !el.querySelectorAll(":checked").length ) { |
1348
|
|
|
rbuggyQSA.push(":checked"); |
1349
|
|
|
} |
1350
|
|
|
|
1351
|
|
|
// Support: Safari 8+, iOS 8+ |
1352
|
|
|
// https://bugs.webkit.org/show_bug.cgi?id=136851 |
1353
|
|
|
// In-page `selector#id sibling-combinator selector` fails |
1354
|
|
|
if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { |
1355
|
|
|
rbuggyQSA.push(".#.+[+~]"); |
1356
|
|
|
} |
1357
|
|
|
}); |
1358
|
|
|
|
1359
|
|
|
assert(function( el ) { |
1360
|
|
|
el.innerHTML = "<a href='' disabled='disabled'></a>" + |
1361
|
|
|
"<select disabled='disabled'><option/></select>"; |
1362
|
|
|
|
1363
|
|
|
// Support: Windows 8 Native Apps |
1364
|
|
|
// The type and name attributes are restricted during .innerHTML assignment |
1365
|
|
|
var input = document.createElement("input"); |
1366
|
|
|
input.setAttribute( "type", "hidden" ); |
1367
|
|
|
el.appendChild( input ).setAttribute( "name", "D" ); |
1368
|
|
|
|
1369
|
|
|
// Support: IE8 |
1370
|
|
|
// Enforce case-sensitivity of name attribute |
1371
|
|
|
if ( el.querySelectorAll("[name=d]").length ) { |
1372
|
|
|
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); |
1373
|
|
|
} |
1374
|
|
|
|
1375
|
|
|
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) |
1376
|
|
|
// IE8 throws error here and will not see later tests |
1377
|
|
|
if ( el.querySelectorAll(":enabled").length !== 2 ) { |
1378
|
|
|
rbuggyQSA.push( ":enabled", ":disabled" ); |
1379
|
|
|
} |
1380
|
|
|
|
1381
|
|
|
// Support: IE9-11+ |
1382
|
|
|
// IE's :disabled selector does not pick up the children of disabled fieldsets |
1383
|
|
|
docElem.appendChild( el ).disabled = true; |
1384
|
|
|
if ( el.querySelectorAll(":disabled").length !== 2 ) { |
1385
|
|
|
rbuggyQSA.push( ":enabled", ":disabled" ); |
1386
|
|
|
} |
1387
|
|
|
|
1388
|
|
|
// Opera 10-11 does not throw on post-comma invalid pseudos |
1389
|
|
|
el.querySelectorAll("*,:x"); |
1390
|
|
|
rbuggyQSA.push(",.*:"); |
1391
|
|
|
}); |
1392
|
|
|
} |
1393
|
|
|
|
1394
|
|
|
if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || |
1395
|
|
|
docElem.webkitMatchesSelector || |
1396
|
|
|
docElem.mozMatchesSelector || |
1397
|
|
|
docElem.oMatchesSelector || |
1398
|
|
|
docElem.msMatchesSelector) )) ) { |
1399
|
|
|
|
1400
|
|
|
assert(function( el ) { |
1401
|
|
|
// Check to see if it's possible to do matchesSelector |
1402
|
|
|
// on a disconnected node (IE 9) |
1403
|
|
|
support.disconnectedMatch = matches.call( el, "*" ); |
1404
|
|
|
|
1405
|
|
|
// This should fail with an exception |
1406
|
|
|
// Gecko does not error, returns false instead |
1407
|
|
|
matches.call( el, "[s!='']:x" ); |
1408
|
|
|
rbuggyMatches.push( "!=", pseudos ); |
1409
|
|
|
}); |
1410
|
|
|
} |
1411
|
|
|
|
1412
|
|
|
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); |
1413
|
|
|
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); |
1414
|
|
|
|
1415
|
|
|
/* Contains |
1416
|
|
|
---------------------------------------------------------------------- */ |
1417
|
|
|
hasCompare = rnative.test( docElem.compareDocumentPosition ); |
1418
|
|
|
|
1419
|
|
|
// Element contains another |
1420
|
|
|
// Purposefully self-exclusive |
1421
|
|
|
// As in, an element does not contain itself |
1422
|
|
|
contains = hasCompare || rnative.test( docElem.contains ) ? |
1423
|
|
|
function( a, b ) { |
1424
|
|
|
var adown = a.nodeType === 9 ? a.documentElement : a, |
1425
|
|
|
bup = b && b.parentNode; |
1426
|
|
|
return a === bup || !!( bup && bup.nodeType === 1 && ( |
1427
|
|
|
adown.contains ? |
1428
|
|
|
adown.contains( bup ) : |
1429
|
|
|
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
1430
|
|
|
)); |
1431
|
|
|
} : |
1432
|
|
|
function( a, b ) { |
1433
|
|
|
if ( b ) { |
1434
|
|
|
while ( (b = b.parentNode) ) { |
1435
|
|
|
if ( b === a ) { |
1436
|
|
|
return true; |
1437
|
|
|
} |
1438
|
|
|
} |
1439
|
|
|
} |
1440
|
|
|
return false; |
1441
|
|
|
}; |
1442
|
|
|
|
1443
|
|
|
/* Sorting |
1444
|
|
|
---------------------------------------------------------------------- */ |
1445
|
|
|
|
1446
|
|
|
// Document order sorting |
1447
|
|
|
sortOrder = hasCompare ? |
1448
|
|
|
function( a, b ) { |
1449
|
|
|
|
1450
|
|
|
// Flag for duplicate removal |
1451
|
|
|
if ( a === b ) { |
1452
|
|
|
hasDuplicate = true; |
1453
|
|
|
return 0; |
1454
|
|
|
} |
1455
|
|
|
|
1456
|
|
|
// Sort on method existence if only one input has compareDocumentPosition |
1457
|
|
|
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; |
1458
|
|
|
if ( compare ) { |
1459
|
|
|
return compare; |
1460
|
|
|
} |
1461
|
|
|
|
1462
|
|
|
// Calculate position if both inputs belong to the same document |
1463
|
|
|
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? |
1464
|
|
|
a.compareDocumentPosition( b ) : |
1465
|
|
|
|
1466
|
|
|
// Otherwise we know they are disconnected |
1467
|
|
|
1; |
1468
|
|
|
|
1469
|
|
|
// Disconnected nodes |
1470
|
|
|
if ( compare & 1 || |
1471
|
|
|
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { |
1472
|
|
|
|
1473
|
|
|
// Choose the first element that is related to our preferred document |
1474
|
|
|
if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { |
1475
|
|
|
return -1; |
1476
|
|
|
} |
1477
|
|
|
if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { |
1478
|
|
|
return 1; |
1479
|
|
|
} |
1480
|
|
|
|
1481
|
|
|
// Maintain original order |
1482
|
|
|
return sortInput ? |
1483
|
|
|
( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
1484
|
|
|
0; |
1485
|
|
|
} |
1486
|
|
|
|
1487
|
|
|
return compare & 4 ? -1 : 1; |
1488
|
|
|
} : |
1489
|
|
|
function( a, b ) { |
1490
|
|
|
// Exit early if the nodes are identical |
1491
|
|
|
if ( a === b ) { |
1492
|
|
|
hasDuplicate = true; |
1493
|
|
|
return 0; |
1494
|
|
|
} |
1495
|
|
|
|
1496
|
|
|
var cur, |
1497
|
|
|
i = 0, |
1498
|
|
|
aup = a.parentNode, |
1499
|
|
|
bup = b.parentNode, |
1500
|
|
|
ap = [ a ], |
1501
|
|
|
bp = [ b ]; |
1502
|
|
|
|
1503
|
|
|
// Parentless nodes are either documents or disconnected |
1504
|
|
|
if ( !aup || !bup ) { |
1505
|
|
|
return a === document ? -1 : |
1506
|
|
|
b === document ? 1 : |
1507
|
|
|
aup ? -1 : |
1508
|
|
|
bup ? 1 : |
1509
|
|
|
sortInput ? |
1510
|
|
|
( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
1511
|
|
|
0; |
1512
|
|
|
|
1513
|
|
|
// If the nodes are siblings, we can do a quick check |
1514
|
|
|
} else if ( aup === bup ) { |
1515
|
|
|
return siblingCheck( a, b ); |
1516
|
|
|
} |
1517
|
|
|
|
1518
|
|
|
// Otherwise we need full lists of their ancestors for comparison |
1519
|
|
|
cur = a; |
1520
|
|
|
while ( (cur = cur.parentNode) ) { |
1521
|
|
|
ap.unshift( cur ); |
1522
|
|
|
} |
1523
|
|
|
cur = b; |
1524
|
|
|
while ( (cur = cur.parentNode) ) { |
1525
|
|
|
bp.unshift( cur ); |
1526
|
|
|
} |
1527
|
|
|
|
1528
|
|
|
// Walk down the tree looking for a discrepancy |
1529
|
|
|
while ( ap[i] === bp[i] ) { |
1530
|
|
|
i++; |
1531
|
|
|
} |
1532
|
|
|
|
1533
|
|
|
return i ? |
1534
|
|
|
// Do a sibling check if the nodes have a common ancestor |
1535
|
|
|
siblingCheck( ap[i], bp[i] ) : |
1536
|
|
|
|
1537
|
|
|
// Otherwise nodes in our document sort first |
1538
|
|
|
ap[i] === preferredDoc ? -1 : |
1539
|
|
|
bp[i] === preferredDoc ? 1 : |
1540
|
|
|
0; |
1541
|
|
|
}; |
1542
|
|
|
|
1543
|
|
|
return document; |
1544
|
|
|
}; |
1545
|
|
|
|
1546
|
|
|
Sizzle.matches = function( expr, elements ) { |
1547
|
|
|
return Sizzle( expr, null, null, elements ); |
1548
|
|
|
}; |
1549
|
|
|
|
1550
|
|
|
Sizzle.matchesSelector = function( elem, expr ) { |
1551
|
|
|
// Set document vars if needed |
1552
|
|
|
if ( ( elem.ownerDocument || elem ) !== document ) { |
1553
|
|
|
setDocument( elem ); |
1554
|
|
|
} |
1555
|
|
|
|
1556
|
|
|
// Make sure that attribute selectors are quoted |
1557
|
|
|
expr = expr.replace( rattributeQuotes, "='$1']" ); |
1558
|
|
|
|
1559
|
|
|
if ( support.matchesSelector && documentIsHTML && |
1560
|
|
|
!compilerCache[ expr + " " ] && |
1561
|
|
|
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && |
1562
|
|
|
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
1563
|
|
|
|
1564
|
|
|
try { |
1565
|
|
|
var ret = matches.call( elem, expr ); |
1566
|
|
|
|
1567
|
|
|
// IE 9's matchesSelector returns false on disconnected nodes |
1568
|
|
|
if ( ret || support.disconnectedMatch || |
1569
|
|
|
// As well, disconnected nodes are said to be in a document |
1570
|
|
|
// fragment in IE 9 |
1571
|
|
|
elem.document && elem.document.nodeType !== 11 ) { |
1572
|
|
|
return ret; |
1573
|
|
|
} |
1574
|
|
|
} catch (e) {} |
1575
|
|
|
} |
1576
|
|
|
|
1577
|
|
|
return Sizzle( expr, document, null, [ elem ] ).length > 0; |
1578
|
|
|
}; |
1579
|
|
|
|
1580
|
|
|
Sizzle.contains = function( context, elem ) { |
1581
|
|
|
// Set document vars if needed |
1582
|
|
|
if ( ( context.ownerDocument || context ) !== document ) { |
1583
|
|
|
setDocument( context ); |
1584
|
|
|
} |
1585
|
|
|
return contains( context, elem ); |
1586
|
|
|
}; |
1587
|
|
|
|
1588
|
|
|
Sizzle.attr = function( elem, name ) { |
1589
|
|
|
// Set document vars if needed |
1590
|
|
|
if ( ( elem.ownerDocument || elem ) !== document ) { |
1591
|
|
|
setDocument( elem ); |
1592
|
|
|
} |
1593
|
|
|
|
1594
|
|
|
var fn = Expr.attrHandle[ name.toLowerCase() ], |
1595
|
|
|
// Don't get fooled by Object.prototype properties (jQuery #13807) |
1596
|
|
|
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
1597
|
|
|
fn( elem, name, !documentIsHTML ) : |
1598
|
|
|
undefined; |
1599
|
|
|
|
1600
|
|
|
return val !== undefined ? |
1601
|
|
|
val : |
1602
|
|
|
support.attributes || !documentIsHTML ? |
1603
|
|
|
elem.getAttribute( name ) : |
1604
|
|
|
(val = elem.getAttributeNode(name)) && val.specified ? |
1605
|
|
|
val.value : |
1606
|
|
|
null; |
1607
|
|
|
}; |
1608
|
|
|
|
1609
|
|
|
Sizzle.escape = function( sel ) { |
1610
|
|
|
return (sel + "").replace( rcssescape, fcssescape ); |
1611
|
|
|
}; |
1612
|
|
|
|
1613
|
|
|
Sizzle.error = function( msg ) { |
1614
|
|
|
throw new Error( "Syntax error, unrecognized expression: " + msg ); |
1615
|
|
|
}; |
1616
|
|
|
|
1617
|
|
|
/** |
1618
|
|
|
* Document sorting and removing duplicates |
1619
|
|
|
* @param {ArrayLike} results |
1620
|
|
|
*/ |
1621
|
|
|
Sizzle.uniqueSort = function( results ) { |
1622
|
|
|
var elem, |
1623
|
|
|
duplicates = [], |
1624
|
|
|
j = 0, |
1625
|
|
|
i = 0; |
1626
|
|
|
|
1627
|
|
|
// Unless we *know* we can detect duplicates, assume their presence |
1628
|
|
|
hasDuplicate = !support.detectDuplicates; |
1629
|
|
|
sortInput = !support.sortStable && results.slice( 0 ); |
1630
|
|
|
results.sort( sortOrder ); |
1631
|
|
|
|
1632
|
|
|
if ( hasDuplicate ) { |
1633
|
|
|
while ( (elem = results[i++]) ) { |
1634
|
|
|
if ( elem === results[ i ] ) { |
1635
|
|
|
j = duplicates.push( i ); |
1636
|
|
|
} |
1637
|
|
|
} |
1638
|
|
|
while ( j-- ) { |
1639
|
|
|
results.splice( duplicates[ j ], 1 ); |
1640
|
|
|
} |
1641
|
|
|
} |
1642
|
|
|
|
1643
|
|
|
// Clear input after sorting to release objects |
1644
|
|
|
// See https://github.com/jquery/sizzle/pull/225 |
1645
|
|
|
sortInput = null; |
1646
|
|
|
|
1647
|
|
|
return results; |
1648
|
|
|
}; |
1649
|
|
|
|
1650
|
|
|
/** |
1651
|
|
|
* Utility function for retrieving the text value of an array of DOM nodes |
1652
|
|
|
* @param {Array|Element} elem |
1653
|
|
|
*/ |
1654
|
|
|
getText = Sizzle.getText = function( elem ) { |
1655
|
|
|
var node, |
1656
|
|
|
ret = "", |
1657
|
|
|
i = 0, |
1658
|
|
|
nodeType = elem.nodeType; |
1659
|
|
|
|
1660
|
|
|
if ( !nodeType ) { |
1661
|
|
|
// If no nodeType, this is expected to be an array |
1662
|
|
|
while ( (node = elem[i++]) ) { |
1663
|
|
|
// Do not traverse comment nodes |
1664
|
|
|
ret += getText( node ); |
1665
|
|
|
} |
1666
|
|
|
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
1667
|
|
|
// Use textContent for elements |
1668
|
|
|
// innerText usage removed for consistency of new lines (jQuery #11153) |
1669
|
|
|
if ( typeof elem.textContent === "string" ) { |
1670
|
|
|
return elem.textContent; |
1671
|
|
|
} else { |
1672
|
|
|
// Traverse its children |
1673
|
|
|
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
1674
|
|
|
ret += getText( elem ); |
1675
|
|
|
} |
1676
|
|
|
} |
1677
|
|
|
} else if ( nodeType === 3 || nodeType === 4 ) { |
1678
|
|
|
return elem.nodeValue; |
1679
|
|
|
} |
1680
|
|
|
// Do not include comment or processing instruction nodes |
1681
|
|
|
|
1682
|
|
|
return ret; |
1683
|
|
|
}; |
1684
|
|
|
|
1685
|
|
|
Expr = Sizzle.selectors = { |
1686
|
|
|
|
1687
|
|
|
// Can be adjusted by the user |
1688
|
|
|
cacheLength: 50, |
1689
|
|
|
|
1690
|
|
|
createPseudo: markFunction, |
1691
|
|
|
|
1692
|
|
|
match: matchExpr, |
1693
|
|
|
|
1694
|
|
|
attrHandle: {}, |
1695
|
|
|
|
1696
|
|
|
find: {}, |
1697
|
|
|
|
1698
|
|
|
relative: { |
1699
|
|
|
">": { dir: "parentNode", first: true }, |
1700
|
|
|
" ": { dir: "parentNode" }, |
1701
|
|
|
"+": { dir: "previousSibling", first: true }, |
1702
|
|
|
"~": { dir: "previousSibling" } |
1703
|
|
|
}, |
1704
|
|
|
|
1705
|
|
|
preFilter: { |
1706
|
|
|
"ATTR": function( match ) { |
1707
|
|
|
match[1] = match[1].replace( runescape, funescape ); |
1708
|
|
|
|
1709
|
|
|
// Move the given value to match[3] whether quoted or unquoted |
1710
|
|
|
match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); |
1711
|
|
|
|
1712
|
|
|
if ( match[2] === "~=" ) { |
1713
|
|
|
match[3] = " " + match[3] + " "; |
1714
|
|
|
} |
1715
|
|
|
|
1716
|
|
|
return match.slice( 0, 4 ); |
1717
|
|
|
}, |
1718
|
|
|
|
1719
|
|
|
"CHILD": function( match ) { |
1720
|
|
|
/* matches from matchExpr["CHILD"] |
1721
|
|
|
1 type (only|nth|...) |
1722
|
|
|
2 what (child|of-type) |
1723
|
|
|
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
1724
|
|
|
4 xn-component of xn+y argument ([+-]?\d*n|) |
1725
|
|
|
5 sign of xn-component |
1726
|
|
|
6 x of xn-component |
1727
|
|
|
7 sign of y-component |
1728
|
|
|
8 y of y-component |
1729
|
|
|
*/ |
1730
|
|
|
match[1] = match[1].toLowerCase(); |
1731
|
|
|
|
1732
|
|
|
if ( match[1].slice( 0, 3 ) === "nth" ) { |
1733
|
|
|
// nth-* requires argument |
1734
|
|
|
if ( !match[3] ) { |
1735
|
|
|
Sizzle.error( match[0] ); |
1736
|
|
|
} |
1737
|
|
|
|
1738
|
|
|
// numeric x and y parameters for Expr.filter.CHILD |
1739
|
|
|
// remember that false/true cast respectively to 0/1 |
1740
|
|
|
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); |
1741
|
|
|
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); |
1742
|
|
|
|
1743
|
|
|
// other types prohibit arguments |
1744
|
|
|
} else if ( match[3] ) { |
1745
|
|
|
Sizzle.error( match[0] ); |
1746
|
|
|
} |
1747
|
|
|
|
1748
|
|
|
return match; |
1749
|
|
|
}, |
1750
|
|
|
|
1751
|
|
|
"PSEUDO": function( match ) { |
1752
|
|
|
var excess, |
1753
|
|
|
unquoted = !match[6] && match[2]; |
1754
|
|
|
|
1755
|
|
|
if ( matchExpr["CHILD"].test( match[0] ) ) { |
1756
|
|
|
return null; |
1757
|
|
|
} |
1758
|
|
|
|
1759
|
|
|
// Accept quoted arguments as-is |
1760
|
|
|
if ( match[3] ) { |
1761
|
|
|
match[2] = match[4] || match[5] || ""; |
1762
|
|
|
|
1763
|
|
|
// Strip excess characters from unquoted arguments |
1764
|
|
|
} else if ( unquoted && rpseudo.test( unquoted ) && |
1765
|
|
|
// Get excess from tokenize (recursively) |
1766
|
|
|
(excess = tokenize( unquoted, true )) && |
1767
|
|
|
// advance to the next closing parenthesis |
1768
|
|
|
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { |
1769
|
|
|
|
1770
|
|
|
// excess is a negative index |
1771
|
|
|
match[0] = match[0].slice( 0, excess ); |
1772
|
|
|
match[2] = unquoted.slice( 0, excess ); |
1773
|
|
|
} |
1774
|
|
|
|
1775
|
|
|
// Return only captures needed by the pseudo filter method (type and argument) |
1776
|
|
|
return match.slice( 0, 3 ); |
1777
|
|
|
} |
1778
|
|
|
}, |
1779
|
|
|
|
1780
|
|
|
filter: { |
1781
|
|
|
|
1782
|
|
|
"TAG": function( nodeNameSelector ) { |
1783
|
|
|
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
1784
|
|
|
return nodeNameSelector === "*" ? |
1785
|
|
|
function() { return true; } : |
1786
|
|
|
function( elem ) { |
1787
|
|
|
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
1788
|
|
|
}; |
1789
|
|
|
}, |
1790
|
|
|
|
1791
|
|
|
"CLASS": function( className ) { |
1792
|
|
|
var pattern = classCache[ className + " " ]; |
1793
|
|
|
|
1794
|
|
|
return pattern || |
1795
|
|
|
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && |
1796
|
|
|
classCache( className, function( elem ) { |
1797
|
|
|
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); |
1798
|
|
|
}); |
1799
|
|
|
}, |
1800
|
|
|
|
1801
|
|
|
"ATTR": function( name, operator, check ) { |
1802
|
|
|
return function( elem ) { |
1803
|
|
|
var result = Sizzle.attr( elem, name ); |
1804
|
|
|
|
1805
|
|
|
if ( result == null ) { |
1806
|
|
|
return operator === "!="; |
1807
|
|
|
} |
1808
|
|
|
if ( !operator ) { |
1809
|
|
|
return true; |
1810
|
|
|
} |
1811
|
|
|
|
1812
|
|
|
result += ""; |
1813
|
|
|
|
1814
|
|
|
return operator === "=" ? result === check : |
1815
|
|
|
operator === "!=" ? result !== check : |
1816
|
|
|
operator === "^=" ? check && result.indexOf( check ) === 0 : |
1817
|
|
|
operator === "*=" ? check && result.indexOf( check ) > -1 : |
1818
|
|
|
operator === "$=" ? check && result.slice( -check.length ) === check : |
1819
|
|
|
operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : |
1820
|
|
|
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : |
1821
|
|
|
false; |
1822
|
|
|
}; |
1823
|
|
|
}, |
1824
|
|
|
|
1825
|
|
|
"CHILD": function( type, what, argument, first, last ) { |
1826
|
|
|
var simple = type.slice( 0, 3 ) !== "nth", |
1827
|
|
|
forward = type.slice( -4 ) !== "last", |
1828
|
|
|
ofType = what === "of-type"; |
1829
|
|
|
|
1830
|
|
|
return first === 1 && last === 0 ? |
1831
|
|
|
|
1832
|
|
|
// Shortcut for :nth-*(n) |
1833
|
|
|
function( elem ) { |
1834
|
|
|
return !!elem.parentNode; |
1835
|
|
|
} : |
1836
|
|
|
|
1837
|
|
|
function( elem, context, xml ) { |
1838
|
|
|
var cache, uniqueCache, outerCache, node, nodeIndex, start, |
1839
|
|
|
dir = simple !== forward ? "nextSibling" : "previousSibling", |
1840
|
|
|
parent = elem.parentNode, |
1841
|
|
|
name = ofType && elem.nodeName.toLowerCase(), |
1842
|
|
|
useCache = !xml && !ofType, |
1843
|
|
|
diff = false; |
1844
|
|
|
|
1845
|
|
|
if ( parent ) { |
1846
|
|
|
|
1847
|
|
|
// :(first|last|only)-(child|of-type) |
1848
|
|
|
if ( simple ) { |
1849
|
|
|
while ( dir ) { |
1850
|
|
|
node = elem; |
1851
|
|
|
while ( (node = node[ dir ]) ) { |
1852
|
|
|
if ( ofType ? |
1853
|
|
|
node.nodeName.toLowerCase() === name : |
1854
|
|
|
node.nodeType === 1 ) { |
1855
|
|
|
|
1856
|
|
|
return false; |
1857
|
|
|
} |
1858
|
|
|
} |
1859
|
|
|
// Reverse direction for :only-* (if we haven't yet done so) |
1860
|
|
|
start = dir = type === "only" && !start && "nextSibling"; |
1861
|
|
|
} |
1862
|
|
|
return true; |
1863
|
|
|
} |
1864
|
|
|
|
1865
|
|
|
start = [ forward ? parent.firstChild : parent.lastChild ]; |
1866
|
|
|
|
1867
|
|
|
// non-xml :nth-child(...) stores cache data on `parent` |
1868
|
|
|
if ( forward && useCache ) { |
1869
|
|
|
|
1870
|
|
|
// Seek `elem` from a previously-cached index |
1871
|
|
|
|
1872
|
|
|
// ...in a gzip-friendly way |
1873
|
|
|
node = parent; |
1874
|
|
|
outerCache = node[ expando ] || (node[ expando ] = {}); |
1875
|
|
|
|
1876
|
|
|
// Support: IE <9 only |
1877
|
|
|
// Defend against cloned attroperties (jQuery gh-1709) |
1878
|
|
|
uniqueCache = outerCache[ node.uniqueID ] || |
1879
|
|
|
(outerCache[ node.uniqueID ] = {}); |
1880
|
|
|
|
1881
|
|
|
cache = uniqueCache[ type ] || []; |
1882
|
|
|
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
1883
|
|
|
diff = nodeIndex && cache[ 2 ]; |
1884
|
|
|
node = nodeIndex && parent.childNodes[ nodeIndex ]; |
1885
|
|
|
|
1886
|
|
|
while ( (node = ++nodeIndex && node && node[ dir ] || |
1887
|
|
|
|
1888
|
|
|
// Fallback to seeking `elem` from the start |
1889
|
|
|
(diff = nodeIndex = 0) || start.pop()) ) { |
1890
|
|
|
|
1891
|
|
|
// When found, cache indexes on `parent` and break |
1892
|
|
|
if ( node.nodeType === 1 && ++diff && node === elem ) { |
1893
|
|
|
uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; |
1894
|
|
|
break; |
1895
|
|
|
} |
1896
|
|
|
} |
1897
|
|
|
|
1898
|
|
|
} else { |
1899
|
|
|
// Use previously-cached element index if available |
1900
|
|
|
if ( useCache ) { |
1901
|
|
|
// ...in a gzip-friendly way |
1902
|
|
|
node = elem; |
1903
|
|
|
outerCache = node[ expando ] || (node[ expando ] = {}); |
1904
|
|
|
|
1905
|
|
|
// Support: IE <9 only |
1906
|
|
|
// Defend against cloned attroperties (jQuery gh-1709) |
1907
|
|
|
uniqueCache = outerCache[ node.uniqueID ] || |
1908
|
|
|
(outerCache[ node.uniqueID ] = {}); |
1909
|
|
|
|
1910
|
|
|
cache = uniqueCache[ type ] || []; |
1911
|
|
|
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
1912
|
|
|
diff = nodeIndex; |
1913
|
|
|
} |
1914
|
|
|
|
1915
|
|
|
// xml :nth-child(...) |
1916
|
|
|
// or :nth-last-child(...) or :nth(-last)?-of-type(...) |
1917
|
|
|
if ( diff === false ) { |
1918
|
|
|
// Use the same loop as above to seek `elem` from the start |
1919
|
|
|
while ( (node = ++nodeIndex && node && node[ dir ] || |
1920
|
|
|
(diff = nodeIndex = 0) || start.pop()) ) { |
1921
|
|
|
|
1922
|
|
|
if ( ( ofType ? |
1923
|
|
|
node.nodeName.toLowerCase() === name : |
1924
|
|
|
node.nodeType === 1 ) && |
1925
|
|
|
++diff ) { |
1926
|
|
|
|
1927
|
|
|
// Cache the index of each encountered element |
1928
|
|
|
if ( useCache ) { |
1929
|
|
|
outerCache = node[ expando ] || (node[ expando ] = {}); |
1930
|
|
|
|
1931
|
|
|
// Support: IE <9 only |
1932
|
|
|
// Defend against cloned attroperties (jQuery gh-1709) |
1933
|
|
|
uniqueCache = outerCache[ node.uniqueID ] || |
1934
|
|
|
(outerCache[ node.uniqueID ] = {}); |
1935
|
|
|
|
1936
|
|
|
uniqueCache[ type ] = [ dirruns, diff ]; |
1937
|
|
|
} |
1938
|
|
|
|
1939
|
|
|
if ( node === elem ) { |
1940
|
|
|
break; |
1941
|
|
|
} |
1942
|
|
|
} |
1943
|
|
|
} |
1944
|
|
|
} |
1945
|
|
|
} |
1946
|
|
|
|
1947
|
|
|
// Incorporate the offset, then check against cycle size |
1948
|
|
|
diff -= last; |
1949
|
|
|
return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
1950
|
|
|
} |
1951
|
|
|
}; |
1952
|
|
|
}, |
1953
|
|
|
|
1954
|
|
|
"PSEUDO": function( pseudo, argument ) { |
1955
|
|
|
// pseudo-class names are case-insensitive |
1956
|
|
|
// http://www.w3.org/TR/selectors/#pseudo-classes |
1957
|
|
|
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
1958
|
|
|
// Remember that setFilters inherits from pseudos |
1959
|
|
|
var args, |
1960
|
|
|
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
1961
|
|
|
Sizzle.error( "unsupported pseudo: " + pseudo ); |
1962
|
|
|
|
1963
|
|
|
// The user may use createPseudo to indicate that |
1964
|
|
|
// arguments are needed to create the filter function |
1965
|
|
|
// just as Sizzle does |
1966
|
|
|
if ( fn[ expando ] ) { |
1967
|
|
|
return fn( argument ); |
1968
|
|
|
} |
1969
|
|
|
|
1970
|
|
|
// But maintain support for old signatures |
1971
|
|
|
if ( fn.length > 1 ) { |
1972
|
|
|
args = [ pseudo, pseudo, "", argument ]; |
1973
|
|
|
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? |
1974
|
|
|
markFunction(function( seed, matches ) { |
1975
|
|
|
var idx, |
1976
|
|
|
matched = fn( seed, argument ), |
1977
|
|
|
i = matched.length; |
1978
|
|
|
while ( i-- ) { |
1979
|
|
|
idx = indexOf( seed, matched[i] ); |
1980
|
|
|
seed[ idx ] = !( matches[ idx ] = matched[i] ); |
1981
|
|
|
} |
1982
|
|
|
}) : |
1983
|
|
|
function( elem ) { |
1984
|
|
|
return fn( elem, 0, args ); |
1985
|
|
|
}; |
1986
|
|
|
} |
1987
|
|
|
|
1988
|
|
|
return fn; |
1989
|
|
|
} |
1990
|
|
|
}, |
1991
|
|
|
|
1992
|
|
|
pseudos: { |
1993
|
|
|
// Potentially complex pseudos |
1994
|
|
|
"not": markFunction(function( selector ) { |
1995
|
|
|
// Trim the selector passed to compile |
1996
|
|
|
// to avoid treating leading and trailing |
1997
|
|
|
// spaces as combinators |
1998
|
|
|
var input = [], |
1999
|
|
|
results = [], |
2000
|
|
|
matcher = compile( selector.replace( rtrim, "$1" ) ); |
2001
|
|
|
|
2002
|
|
|
return matcher[ expando ] ? |
2003
|
|
|
markFunction(function( seed, matches, context, xml ) { |
2004
|
|
|
var elem, |
2005
|
|
|
unmatched = matcher( seed, null, xml, [] ), |
2006
|
|
|
i = seed.length; |
2007
|
|
|
|
2008
|
|
|
// Match elements unmatched by `matcher` |
2009
|
|
|
while ( i-- ) { |
2010
|
|
|
if ( (elem = unmatched[i]) ) { |
2011
|
|
|
seed[i] = !(matches[i] = elem); |
2012
|
|
|
} |
2013
|
|
|
} |
2014
|
|
|
}) : |
2015
|
|
|
function( elem, context, xml ) { |
2016
|
|
|
input[0] = elem; |
2017
|
|
|
matcher( input, null, xml, results ); |
2018
|
|
|
// Don't keep the element (issue #299) |
2019
|
|
|
input[0] = null; |
2020
|
|
|
return !results.pop(); |
2021
|
|
|
}; |
2022
|
|
|
}), |
2023
|
|
|
|
2024
|
|
|
"has": markFunction(function( selector ) { |
2025
|
|
|
return function( elem ) { |
2026
|
|
|
return Sizzle( selector, elem ).length > 0; |
2027
|
|
|
}; |
2028
|
|
|
}), |
2029
|
|
|
|
2030
|
|
|
"contains": markFunction(function( text ) { |
2031
|
|
|
text = text.replace( runescape, funescape ); |
2032
|
|
|
return function( elem ) { |
2033
|
|
|
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; |
2034
|
|
|
}; |
2035
|
|
|
}), |
2036
|
|
|
|
2037
|
|
|
// "Whether an element is represented by a :lang() selector |
2038
|
|
|
// is based solely on the element's language value |
2039
|
|
|
// being equal to the identifier C, |
2040
|
|
|
// or beginning with the identifier C immediately followed by "-". |
2041
|
|
|
// The matching of C against the element's language value is performed case-insensitively. |
2042
|
|
|
// The identifier C does not have to be a valid language name." |
2043
|
|
|
// http://www.w3.org/TR/selectors/#lang-pseudo |
2044
|
|
|
"lang": markFunction( function( lang ) { |
2045
|
|
|
// lang value must be a valid identifier |
2046
|
|
|
if ( !ridentifier.test(lang || "") ) { |
2047
|
|
|
Sizzle.error( "unsupported lang: " + lang ); |
2048
|
|
|
} |
2049
|
|
|
lang = lang.replace( runescape, funescape ).toLowerCase(); |
2050
|
|
|
return function( elem ) { |
2051
|
|
|
var elemLang; |
2052
|
|
|
do { |
2053
|
|
|
if ( (elemLang = documentIsHTML ? |
2054
|
|
|
elem.lang : |
2055
|
|
|
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { |
2056
|
|
|
|
2057
|
|
|
elemLang = elemLang.toLowerCase(); |
2058
|
|
|
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; |
2059
|
|
|
} |
2060
|
|
|
} while ( (elem = elem.parentNode) && elem.nodeType === 1 ); |
2061
|
|
|
return false; |
2062
|
|
|
}; |
2063
|
|
|
}), |
2064
|
|
|
|
2065
|
|
|
// Miscellaneous |
2066
|
|
|
"target": function( elem ) { |
2067
|
|
|
var hash = window.location && window.location.hash; |
2068
|
|
|
return hash && hash.slice( 1 ) === elem.id; |
2069
|
|
|
}, |
2070
|
|
|
|
2071
|
|
|
"root": function( elem ) { |
2072
|
|
|
return elem === docElem; |
2073
|
|
|
}, |
2074
|
|
|
|
2075
|
|
|
"focus": function( elem ) { |
2076
|
|
|
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); |
2077
|
|
|
}, |
2078
|
|
|
|
2079
|
|
|
// Boolean properties |
2080
|
|
|
"enabled": createDisabledPseudo( false ), |
2081
|
|
|
"disabled": createDisabledPseudo( true ), |
2082
|
|
|
|
2083
|
|
|
"checked": function( elem ) { |
2084
|
|
|
// In CSS3, :checked should return both checked and selected elements |
2085
|
|
|
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
2086
|
|
|
var nodeName = elem.nodeName.toLowerCase(); |
2087
|
|
|
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); |
2088
|
|
|
}, |
2089
|
|
|
|
2090
|
|
|
"selected": function( elem ) { |
2091
|
|
|
// Accessing this property makes selected-by-default |
2092
|
|
|
// options in Safari work properly |
2093
|
|
|
if ( elem.parentNode ) { |
2094
|
|
|
elem.parentNode.selectedIndex; |
2095
|
|
|
} |
2096
|
|
|
|
2097
|
|
|
return elem.selected === true; |
2098
|
|
|
}, |
2099
|
|
|
|
2100
|
|
|
// Contents |
2101
|
|
|
"empty": function( elem ) { |
2102
|
|
|
// http://www.w3.org/TR/selectors/#empty-pseudo |
2103
|
|
|
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
2104
|
|
|
// but not by others (comment: 8; processing instruction: 7; etc.) |
2105
|
|
|
// nodeType < 6 works because attributes (2) do not appear as children |
2106
|
|
|
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
2107
|
|
|
if ( elem.nodeType < 6 ) { |
2108
|
|
|
return false; |
2109
|
|
|
} |
2110
|
|
|
} |
2111
|
|
|
return true; |
2112
|
|
|
}, |
2113
|
|
|
|
2114
|
|
|
"parent": function( elem ) { |
2115
|
|
|
return !Expr.pseudos["empty"]( elem ); |
2116
|
|
|
}, |
2117
|
|
|
|
2118
|
|
|
// Element/input types |
2119
|
|
|
"header": function( elem ) { |
2120
|
|
|
return rheader.test( elem.nodeName ); |
2121
|
|
|
}, |
2122
|
|
|
|
2123
|
|
|
"input": function( elem ) { |
2124
|
|
|
return rinputs.test( elem.nodeName ); |
2125
|
|
|
}, |
2126
|
|
|
|
2127
|
|
|
"button": function( elem ) { |
2128
|
|
|
var name = elem.nodeName.toLowerCase(); |
2129
|
|
|
return name === "input" && elem.type === "button" || name === "button"; |
2130
|
|
|
}, |
2131
|
|
|
|
2132
|
|
|
"text": function( elem ) { |
2133
|
|
|
var attr; |
2134
|
|
|
return elem.nodeName.toLowerCase() === "input" && |
2135
|
|
|
elem.type === "text" && |
2136
|
|
|
|
2137
|
|
|
// Support: IE<8 |
2138
|
|
|
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text" |
2139
|
|
|
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); |
2140
|
|
|
}, |
2141
|
|
|
|
2142
|
|
|
// Position-in-collection |
2143
|
|
|
"first": createPositionalPseudo(function() { |
2144
|
|
|
return [ 0 ]; |
2145
|
|
|
}), |
2146
|
|
|
|
2147
|
|
|
"last": createPositionalPseudo(function( matchIndexes, length ) { |
2148
|
|
|
return [ length - 1 ]; |
2149
|
|
|
}), |
2150
|
|
|
|
2151
|
|
|
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) { |
2152
|
|
|
return [ argument < 0 ? argument + length : argument ]; |
2153
|
|
|
}), |
2154
|
|
|
|
2155
|
|
|
"even": createPositionalPseudo(function( matchIndexes, length ) { |
2156
|
|
|
var i = 0; |
2157
|
|
|
for ( ; i < length; i += 2 ) { |
2158
|
|
|
matchIndexes.push( i ); |
2159
|
|
|
} |
2160
|
|
|
return matchIndexes; |
2161
|
|
|
}), |
2162
|
|
|
|
2163
|
|
|
"odd": createPositionalPseudo(function( matchIndexes, length ) { |
2164
|
|
|
var i = 1; |
2165
|
|
|
for ( ; i < length; i += 2 ) { |
2166
|
|
|
matchIndexes.push( i ); |
2167
|
|
|
} |
2168
|
|
|
return matchIndexes; |
2169
|
|
|
}), |
2170
|
|
|
|
2171
|
|
|
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
2172
|
|
|
var i = argument < 0 ? argument + length : argument; |
2173
|
|
|
for ( ; --i >= 0; ) { |
2174
|
|
|
matchIndexes.push( i ); |
2175
|
|
|
} |
2176
|
|
|
return matchIndexes; |
2177
|
|
|
}), |
2178
|
|
|
|
2179
|
|
|
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
2180
|
|
|
var i = argument < 0 ? argument + length : argument; |
2181
|
|
|
for ( ; ++i < length; ) { |
2182
|
|
|
matchIndexes.push( i ); |
2183
|
|
|
} |
2184
|
|
|
return matchIndexes; |
2185
|
|
|
}) |
2186
|
|
|
} |
2187
|
|
|
}; |
2188
|
|
|
|
2189
|
|
|
Expr.pseudos["nth"] = Expr.pseudos["eq"]; |
2190
|
|
|
|
2191
|
|
|
// Add button/input type pseudos |
2192
|
|
|
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
2193
|
|
|
Expr.pseudos[ i ] = createInputPseudo( i ); |
2194
|
|
|
} |
2195
|
|
|
for ( i in { submit: true, reset: true } ) { |
2196
|
|
|
Expr.pseudos[ i ] = createButtonPseudo( i ); |
2197
|
|
|
} |
2198
|
|
|
|
2199
|
|
|
// Easy API for creating new setFilters |
2200
|
|
|
function setFilters() {} |
2201
|
|
|
setFilters.prototype = Expr.filters = Expr.pseudos; |
2202
|
|
|
Expr.setFilters = new setFilters(); |
2203
|
|
|
|
2204
|
|
|
tokenize = Sizzle.tokenize = function( selector, parseOnly ) { |
2205
|
|
|
var matched, match, tokens, type, |
2206
|
|
|
soFar, groups, preFilters, |
2207
|
|
|
cached = tokenCache[ selector + " " ]; |
2208
|
|
|
|
2209
|
|
|
if ( cached ) { |
2210
|
|
|
return parseOnly ? 0 : cached.slice( 0 ); |
2211
|
|
|
} |
2212
|
|
|
|
2213
|
|
|
soFar = selector; |
2214
|
|
|
groups = []; |
2215
|
|
|
preFilters = Expr.preFilter; |
2216
|
|
|
|
2217
|
|
|
while ( soFar ) { |
2218
|
|
|
|
2219
|
|
|
// Comma and first run |
2220
|
|
|
if ( !matched || (match = rcomma.exec( soFar )) ) { |
2221
|
|
|
if ( match ) { |
2222
|
|
|
// Don't consume trailing commas as valid |
2223
|
|
|
soFar = soFar.slice( match[0].length ) || soFar; |
2224
|
|
|
} |
2225
|
|
|
groups.push( (tokens = []) ); |
2226
|
|
|
} |
2227
|
|
|
|
2228
|
|
|
matched = false; |
2229
|
|
|
|
2230
|
|
|
// Combinators |
2231
|
|
|
if ( (match = rcombinators.exec( soFar )) ) { |
2232
|
|
|
matched = match.shift(); |
2233
|
|
|
tokens.push({ |
2234
|
|
|
value: matched, |
2235
|
|
|
// Cast descendant combinators to space |
2236
|
|
|
type: match[0].replace( rtrim, " " ) |
2237
|
|
|
}); |
2238
|
|
|
soFar = soFar.slice( matched.length ); |
2239
|
|
|
} |
2240
|
|
|
|
2241
|
|
|
// Filters |
2242
|
|
|
for ( type in Expr.filter ) { |
2243
|
|
|
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || |
2244
|
|
|
(match = preFilters[ type ]( match ))) ) { |
2245
|
|
|
matched = match.shift(); |
2246
|
|
|
tokens.push({ |
2247
|
|
|
value: matched, |
2248
|
|
|
type: type, |
2249
|
|
|
matches: match |
2250
|
|
|
}); |
2251
|
|
|
soFar = soFar.slice( matched.length ); |
2252
|
|
|
} |
2253
|
|
|
} |
2254
|
|
|
|
2255
|
|
|
if ( !matched ) { |
2256
|
|
|
break; |
2257
|
|
|
} |
2258
|
|
|
} |
2259
|
|
|
|
2260
|
|
|
// Return the length of the invalid excess |
2261
|
|
|
// if we're just parsing |
2262
|
|
|
// Otherwise, throw an error or return tokens |
2263
|
|
|
return parseOnly ? |
2264
|
|
|
soFar.length : |
2265
|
|
|
soFar ? |
2266
|
|
|
Sizzle.error( selector ) : |
2267
|
|
|
// Cache the tokens |
2268
|
|
|
tokenCache( selector, groups ).slice( 0 ); |
2269
|
|
|
}; |
2270
|
|
|
|
2271
|
|
|
function toSelector( tokens ) { |
2272
|
|
|
var i = 0, |
2273
|
|
|
len = tokens.length, |
2274
|
|
|
selector = ""; |
2275
|
|
|
for ( ; i < len; i++ ) { |
2276
|
|
|
selector += tokens[i].value; |
2277
|
|
|
} |
2278
|
|
|
return selector; |
2279
|
|
|
} |
2280
|
|
|
|
2281
|
|
|
function addCombinator( matcher, combinator, base ) { |
2282
|
|
|
var dir = combinator.dir, |
2283
|
|
|
skip = combinator.next, |
2284
|
|
|
key = skip || dir, |
2285
|
|
|
checkNonElements = base && key === "parentNode", |
2286
|
|
|
doneName = done++; |
2287
|
|
|
|
2288
|
|
|
return combinator.first ? |
2289
|
|
|
// Check against closest ancestor/preceding element |
2290
|
|
|
function( elem, context, xml ) { |
2291
|
|
|
while ( (elem = elem[ dir ]) ) { |
2292
|
|
|
if ( elem.nodeType === 1 || checkNonElements ) { |
2293
|
|
|
return matcher( elem, context, xml ); |
2294
|
|
|
} |
2295
|
|
|
} |
2296
|
|
|
return false; |
2297
|
|
|
} : |
2298
|
|
|
|
2299
|
|
|
// Check against all ancestor/preceding elements |
2300
|
|
|
function( elem, context, xml ) { |
2301
|
|
|
var oldCache, uniqueCache, outerCache, |
2302
|
|
|
newCache = [ dirruns, doneName ]; |
2303
|
|
|
|
2304
|
|
|
// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
2305
|
|
|
if ( xml ) { |
2306
|
|
|
while ( (elem = elem[ dir ]) ) { |
2307
|
|
|
if ( elem.nodeType === 1 || checkNonElements ) { |
2308
|
|
|
if ( matcher( elem, context, xml ) ) { |
2309
|
|
|
return true; |
2310
|
|
|
} |
2311
|
|
|
} |
2312
|
|
|
} |
2313
|
|
|
} else { |
2314
|
|
|
while ( (elem = elem[ dir ]) ) { |
2315
|
|
|
if ( elem.nodeType === 1 || checkNonElements ) { |
2316
|
|
|
outerCache = elem[ expando ] || (elem[ expando ] = {}); |
2317
|
|
|
|
2318
|
|
|
// Support: IE <9 only |
2319
|
|
|
// Defend against cloned attroperties (jQuery gh-1709) |
2320
|
|
|
uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); |
2321
|
|
|
|
2322
|
|
|
if ( skip && skip === elem.nodeName.toLowerCase() ) { |
2323
|
|
|
elem = elem[ dir ] || elem; |
2324
|
|
|
} else if ( (oldCache = uniqueCache[ key ]) && |
2325
|
|
|
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
2326
|
|
|
|
2327
|
|
|
// Assign to newCache so results back-propagate to previous elements |
2328
|
|
|
return (newCache[ 2 ] = oldCache[ 2 ]); |
2329
|
|
|
} else { |
2330
|
|
|
// Reuse newcache so results back-propagate to previous elements |
2331
|
|
|
uniqueCache[ key ] = newCache; |
2332
|
|
|
|
2333
|
|
|
// A match means we're done; a fail means we have to keep checking |
2334
|
|
|
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { |
2335
|
|
|
return true; |
2336
|
|
|
} |
2337
|
|
|
} |
2338
|
|
|
} |
2339
|
|
|
} |
2340
|
|
|
} |
2341
|
|
|
return false; |
2342
|
|
|
}; |
2343
|
|
|
} |
2344
|
|
|
|
2345
|
|
|
function elementMatcher( matchers ) { |
2346
|
|
|
return matchers.length > 1 ? |
2347
|
|
|
function( elem, context, xml ) { |
2348
|
|
|
var i = matchers.length; |
2349
|
|
|
while ( i-- ) { |
2350
|
|
|
if ( !matchers[i]( elem, context, xml ) ) { |
2351
|
|
|
return false; |
2352
|
|
|
} |
2353
|
|
|
} |
2354
|
|
|
return true; |
2355
|
|
|
} : |
2356
|
|
|
matchers[0]; |
2357
|
|
|
} |
2358
|
|
|
|
2359
|
|
|
function multipleContexts( selector, contexts, results ) { |
2360
|
|
|
var i = 0, |
2361
|
|
|
len = contexts.length; |
2362
|
|
|
for ( ; i < len; i++ ) { |
2363
|
|
|
Sizzle( selector, contexts[i], results ); |
2364
|
|
|
} |
2365
|
|
|
return results; |
2366
|
|
|
} |
2367
|
|
|
|
2368
|
|
|
function condense( unmatched, map, filter, context, xml ) { |
2369
|
|
|
var elem, |
2370
|
|
|
newUnmatched = [], |
2371
|
|
|
i = 0, |
2372
|
|
|
len = unmatched.length, |
2373
|
|
|
mapped = map != null; |
2374
|
|
|
|
2375
|
|
|
for ( ; i < len; i++ ) { |
2376
|
|
|
if ( (elem = unmatched[i]) ) { |
2377
|
|
|
if ( !filter || filter( elem, context, xml ) ) { |
2378
|
|
|
newUnmatched.push( elem ); |
2379
|
|
|
if ( mapped ) { |
2380
|
|
|
map.push( i ); |
2381
|
|
|
} |
2382
|
|
|
} |
2383
|
|
|
} |
2384
|
|
|
} |
2385
|
|
|
|
2386
|
|
|
return newUnmatched; |
2387
|
|
|
} |
2388
|
|
|
|
2389
|
|
|
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
2390
|
|
|
if ( postFilter && !postFilter[ expando ] ) { |
2391
|
|
|
postFilter = setMatcher( postFilter ); |
2392
|
|
|
} |
2393
|
|
|
if ( postFinder && !postFinder[ expando ] ) { |
2394
|
|
|
postFinder = setMatcher( postFinder, postSelector ); |
2395
|
|
|
} |
2396
|
|
|
return markFunction(function( seed, results, context, xml ) { |
2397
|
|
|
var temp, i, elem, |
2398
|
|
|
preMap = [], |
2399
|
|
|
postMap = [], |
2400
|
|
|
preexisting = results.length, |
2401
|
|
|
|
2402
|
|
|
// Get initial elements from seed or context |
2403
|
|
|
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
2404
|
|
|
|
2405
|
|
|
// Prefilter to get matcher input, preserving a map for seed-results synchronization |
2406
|
|
|
matcherIn = preFilter && ( seed || !selector ) ? |
2407
|
|
|
condense( elems, preMap, preFilter, context, xml ) : |
2408
|
|
|
elems, |
2409
|
|
|
|
2410
|
|
|
matcherOut = matcher ? |
2411
|
|
|
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
2412
|
|
|
postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
2413
|
|
|
|
2414
|
|
|
// ...intermediate processing is necessary |
2415
|
|
|
[] : |
2416
|
|
|
|
2417
|
|
|
// ...otherwise use results directly |
2418
|
|
|
results : |
2419
|
|
|
matcherIn; |
2420
|
|
|
|
2421
|
|
|
// Find primary matches |
2422
|
|
|
if ( matcher ) { |
2423
|
|
|
matcher( matcherIn, matcherOut, context, xml ); |
2424
|
|
|
} |
2425
|
|
|
|
2426
|
|
|
// Apply postFilter |
2427
|
|
|
if ( postFilter ) { |
2428
|
|
|
temp = condense( matcherOut, postMap ); |
2429
|
|
|
postFilter( temp, [], context, xml ); |
2430
|
|
|
|
2431
|
|
|
// Un-match failing elements by moving them back to matcherIn |
2432
|
|
|
i = temp.length; |
2433
|
|
|
while ( i-- ) { |
2434
|
|
|
if ( (elem = temp[i]) ) { |
2435
|
|
|
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
2436
|
|
|
} |
2437
|
|
|
} |
2438
|
|
|
} |
2439
|
|
|
|
2440
|
|
|
if ( seed ) { |
2441
|
|
|
if ( postFinder || preFilter ) { |
2442
|
|
|
if ( postFinder ) { |
2443
|
|
|
// Get the final matcherOut by condensing this intermediate into postFinder contexts |
2444
|
|
|
temp = []; |
2445
|
|
|
i = matcherOut.length; |
2446
|
|
|
while ( i-- ) { |
2447
|
|
|
if ( (elem = matcherOut[i]) ) { |
2448
|
|
|
// Restore matcherIn since elem is not yet a final match |
2449
|
|
|
temp.push( (matcherIn[i] = elem) ); |
2450
|
|
|
} |
2451
|
|
|
} |
2452
|
|
|
postFinder( null, (matcherOut = []), temp, xml ); |
2453
|
|
|
} |
2454
|
|
|
|
2455
|
|
|
// Move matched elements from seed to results to keep them synchronized |
2456
|
|
|
i = matcherOut.length; |
2457
|
|
|
while ( i-- ) { |
2458
|
|
|
if ( (elem = matcherOut[i]) && |
2459
|
|
|
(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { |
2460
|
|
|
|
2461
|
|
|
seed[temp] = !(results[temp] = elem); |
2462
|
|
|
} |
2463
|
|
|
} |
2464
|
|
|
} |
2465
|
|
|
|
2466
|
|
|
// Add elements to results, through postFinder if defined |
2467
|
|
|
} else { |
2468
|
|
|
matcherOut = condense( |
2469
|
|
|
matcherOut === results ? |
2470
|
|
|
matcherOut.splice( preexisting, matcherOut.length ) : |
2471
|
|
|
matcherOut |
2472
|
|
|
); |
2473
|
|
|
if ( postFinder ) { |
2474
|
|
|
postFinder( null, results, matcherOut, xml ); |
2475
|
|
|
} else { |
2476
|
|
|
push.apply( results, matcherOut ); |
2477
|
|
|
} |
2478
|
|
|
} |
2479
|
|
|
}); |
2480
|
|
|
} |
2481
|
|
|
|
2482
|
|
|
function matcherFromTokens( tokens ) { |
2483
|
|
|
var checkContext, matcher, j, |
2484
|
|
|
len = tokens.length, |
2485
|
|
|
leadingRelative = Expr.relative[ tokens[0].type ], |
2486
|
|
|
implicitRelative = leadingRelative || Expr.relative[" "], |
2487
|
|
|
i = leadingRelative ? 1 : 0, |
2488
|
|
|
|
2489
|
|
|
// The foundational matcher ensures that elements are reachable from top-level context(s) |
2490
|
|
|
matchContext = addCombinator( function( elem ) { |
2491
|
|
|
return elem === checkContext; |
2492
|
|
|
}, implicitRelative, true ), |
2493
|
|
|
matchAnyContext = addCombinator( function( elem ) { |
2494
|
|
|
return indexOf( checkContext, elem ) > -1; |
2495
|
|
|
}, implicitRelative, true ), |
2496
|
|
|
matchers = [ function( elem, context, xml ) { |
2497
|
|
|
var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( |
2498
|
|
|
(checkContext = context).nodeType ? |
2499
|
|
|
matchContext( elem, context, xml ) : |
2500
|
|
|
matchAnyContext( elem, context, xml ) ); |
2501
|
|
|
// Avoid hanging onto element (issue #299) |
2502
|
|
|
checkContext = null; |
2503
|
|
|
return ret; |
2504
|
|
|
} ]; |
2505
|
|
|
|
2506
|
|
|
for ( ; i < len; i++ ) { |
2507
|
|
|
if ( (matcher = Expr.relative[ tokens[i].type ]) ) { |
2508
|
|
|
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; |
2509
|
|
|
} else { |
2510
|
|
|
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); |
2511
|
|
|
|
2512
|
|
|
// Return special upon seeing a positional matcher |
2513
|
|
|
if ( matcher[ expando ] ) { |
2514
|
|
|
// Find the next relative operator (if any) for proper handling |
2515
|
|
|
j = ++i; |
2516
|
|
|
for ( ; j < len; j++ ) { |
2517
|
|
|
if ( Expr.relative[ tokens[j].type ] ) { |
2518
|
|
|
break; |
2519
|
|
|
} |
2520
|
|
|
} |
2521
|
|
|
return setMatcher( |
2522
|
|
|
i > 1 && elementMatcher( matchers ), |
2523
|
|
|
i > 1 && toSelector( |
2524
|
|
|
// If the preceding token was a descendant combinator, insert an implicit any-element `*` |
2525
|
|
|
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) |
2526
|
|
|
).replace( rtrim, "$1" ), |
2527
|
|
|
matcher, |
2528
|
|
|
i < j && matcherFromTokens( tokens.slice( i, j ) ), |
2529
|
|
|
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), |
2530
|
|
|
j < len && toSelector( tokens ) |
2531
|
|
|
); |
2532
|
|
|
} |
2533
|
|
|
matchers.push( matcher ); |
2534
|
|
|
} |
2535
|
|
|
} |
2536
|
|
|
|
2537
|
|
|
return elementMatcher( matchers ); |
2538
|
|
|
} |
2539
|
|
|
|
2540
|
|
|
function matcherFromGroupMatchers( elementMatchers, setMatchers ) { |
2541
|
|
|
var bySet = setMatchers.length > 0, |
2542
|
|
|
byElement = elementMatchers.length > 0, |
2543
|
|
|
superMatcher = function( seed, context, xml, results, outermost ) { |
2544
|
|
|
var elem, j, matcher, |
2545
|
|
|
matchedCount = 0, |
2546
|
|
|
i = "0", |
2547
|
|
|
unmatched = seed && [], |
2548
|
|
|
setMatched = [], |
2549
|
|
|
contextBackup = outermostContext, |
2550
|
|
|
// We must always have either seed elements or outermost context |
2551
|
|
|
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), |
2552
|
|
|
// Use integer dirruns iff this is the outermost matcher |
2553
|
|
|
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), |
2554
|
|
|
len = elems.length; |
2555
|
|
|
|
2556
|
|
|
if ( outermost ) { |
2557
|
|
|
outermostContext = context === document || context || outermost; |
2558
|
|
|
} |
2559
|
|
|
|
2560
|
|
|
// Add elements passing elementMatchers directly to results |
2561
|
|
|
// Support: IE<9, Safari |
2562
|
|
|
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
2563
|
|
|
for ( ; i !== len && (elem = elems[i]) != null; i++ ) { |
2564
|
|
|
if ( byElement && elem ) { |
2565
|
|
|
j = 0; |
2566
|
|
|
if ( !context && elem.ownerDocument !== document ) { |
2567
|
|
|
setDocument( elem ); |
2568
|
|
|
xml = !documentIsHTML; |
2569
|
|
|
} |
2570
|
|
|
while ( (matcher = elementMatchers[j++]) ) { |
2571
|
|
|
if ( matcher( elem, context || document, xml) ) { |
2572
|
|
|
results.push( elem ); |
2573
|
|
|
break; |
2574
|
|
|
} |
2575
|
|
|
} |
2576
|
|
|
if ( outermost ) { |
2577
|
|
|
dirruns = dirrunsUnique; |
2578
|
|
|
} |
2579
|
|
|
} |
2580
|
|
|
|
2581
|
|
|
// Track unmatched elements for set filters |
2582
|
|
|
if ( bySet ) { |
2583
|
|
|
// They will have gone through all possible matchers |
2584
|
|
|
if ( (elem = !matcher && elem) ) { |
2585
|
|
|
matchedCount--; |
2586
|
|
|
} |
2587
|
|
|
|
2588
|
|
|
// Lengthen the array for every element, matched or not |
2589
|
|
|
if ( seed ) { |
2590
|
|
|
unmatched.push( elem ); |
2591
|
|
|
} |
2592
|
|
|
} |
2593
|
|
|
} |
2594
|
|
|
|
2595
|
|
|
// `i` is now the count of elements visited above, and adding it to `matchedCount` |
2596
|
|
|
// makes the latter nonnegative. |
2597
|
|
|
matchedCount += i; |
2598
|
|
|
|
2599
|
|
|
// Apply set filters to unmatched elements |
2600
|
|
|
// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` |
2601
|
|
|
// equals `i`), unless we didn't visit _any_ elements in the above loop because we have |
2602
|
|
|
// no element matchers and no seed. |
2603
|
|
|
// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that |
2604
|
|
|
// case, which will result in a "00" `matchedCount` that differs from `i` but is also |
2605
|
|
|
// numerically zero. |
2606
|
|
|
if ( bySet && i !== matchedCount ) { |
2607
|
|
|
j = 0; |
2608
|
|
|
while ( (matcher = setMatchers[j++]) ) { |
2609
|
|
|
matcher( unmatched, setMatched, context, xml ); |
2610
|
|
|
} |
2611
|
|
|
|
2612
|
|
|
if ( seed ) { |
2613
|
|
|
// Reintegrate element matches to eliminate the need for sorting |
2614
|
|
|
if ( matchedCount > 0 ) { |
2615
|
|
|
while ( i-- ) { |
2616
|
|
|
if ( !(unmatched[i] || setMatched[i]) ) { |
2617
|
|
|
setMatched[i] = pop.call( results ); |
2618
|
|
|
} |
2619
|
|
|
} |
2620
|
|
|
} |
2621
|
|
|
|
2622
|
|
|
// Discard index placeholder values to get only actual matches |
2623
|
|
|
setMatched = condense( setMatched ); |
2624
|
|
|
} |
2625
|
|
|
|
2626
|
|
|
// Add matches to results |
2627
|
|
|
push.apply( results, setMatched ); |
2628
|
|
|
|
2629
|
|
|
// Seedless set matches succeeding multiple successful matchers stipulate sorting |
2630
|
|
|
if ( outermost && !seed && setMatched.length > 0 && |
2631
|
|
|
( matchedCount + setMatchers.length ) > 1 ) { |
2632
|
|
|
|
2633
|
|
|
Sizzle.uniqueSort( results ); |
2634
|
|
|
} |
2635
|
|
|
} |
2636
|
|
|
|
2637
|
|
|
// Override manipulation of globals by nested matchers |
2638
|
|
|
if ( outermost ) { |
2639
|
|
|
dirruns = dirrunsUnique; |
2640
|
|
|
outermostContext = contextBackup; |
2641
|
|
|
} |
2642
|
|
|
|
2643
|
|
|
return unmatched; |
2644
|
|
|
}; |
2645
|
|
|
|
2646
|
|
|
return bySet ? |
2647
|
|
|
markFunction( superMatcher ) : |
2648
|
|
|
superMatcher; |
2649
|
|
|
} |
2650
|
|
|
|
2651
|
|
|
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { |
2652
|
|
|
var i, |
2653
|
|
|
setMatchers = [], |
2654
|
|
|
elementMatchers = [], |
2655
|
|
|
cached = compilerCache[ selector + " " ]; |
2656
|
|
|
|
2657
|
|
|
if ( !cached ) { |
2658
|
|
|
// Generate a function of recursive functions that can be used to check each element |
2659
|
|
|
if ( !match ) { |
2660
|
|
|
match = tokenize( selector ); |
2661
|
|
|
} |
2662
|
|
|
i = match.length; |
2663
|
|
|
while ( i-- ) { |
2664
|
|
|
cached = matcherFromTokens( match[i] ); |
2665
|
|
|
if ( cached[ expando ] ) { |
2666
|
|
|
setMatchers.push( cached ); |
2667
|
|
|
} else { |
2668
|
|
|
elementMatchers.push( cached ); |
2669
|
|
|
} |
2670
|
|
|
} |
2671
|
|
|
|
2672
|
|
|
// Cache the compiled function |
2673
|
|
|
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); |
2674
|
|
|
|
2675
|
|
|
// Save selector and tokenization |
2676
|
|
|
cached.selector = selector; |
2677
|
|
|
} |
2678
|
|
|
return cached; |
2679
|
|
|
}; |
2680
|
|
|
|
2681
|
|
|
/** |
2682
|
|
|
* A low-level selection function that works with Sizzle's compiled |
2683
|
|
|
* selector functions |
2684
|
|
|
* @param {String|Function} selector A selector or a pre-compiled |
2685
|
|
|
* selector function built with Sizzle.compile |
2686
|
|
|
* @param {Element} context |
2687
|
|
|
* @param {Array} [results] |
2688
|
|
|
* @param {Array} [seed] A set of elements to match against |
2689
|
|
|
*/ |
2690
|
|
|
select = Sizzle.select = function( selector, context, results, seed ) { |
2691
|
|
|
var i, tokens, token, type, find, |
2692
|
|
|
compiled = typeof selector === "function" && selector, |
2693
|
|
|
match = !seed && tokenize( (selector = compiled.selector || selector) ); |
2694
|
|
|
|
2695
|
|
|
results = results || []; |
2696
|
|
|
|
2697
|
|
|
// Try to minimize operations if there is only one selector in the list and no seed |
2698
|
|
|
// (the latter of which guarantees us context) |
2699
|
|
|
if ( match.length === 1 ) { |
2700
|
|
|
|
2701
|
|
|
// Reduce context if the leading compound selector is an ID |
2702
|
|
|
tokens = match[0] = match[0].slice( 0 ); |
2703
|
|
|
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && |
2704
|
|
|
context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { |
2705
|
|
|
|
2706
|
|
|
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; |
2707
|
|
|
if ( !context ) { |
2708
|
|
|
return results; |
2709
|
|
|
|
2710
|
|
|
// Precompiled matchers will still verify ancestry, so step up a level |
2711
|
|
|
} else if ( compiled ) { |
2712
|
|
|
context = context.parentNode; |
2713
|
|
|
} |
2714
|
|
|
|
2715
|
|
|
selector = selector.slice( tokens.shift().value.length ); |
2716
|
|
|
} |
2717
|
|
|
|
2718
|
|
|
// Fetch a seed set for right-to-left matching |
2719
|
|
|
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; |
2720
|
|
|
while ( i-- ) { |
2721
|
|
|
token = tokens[i]; |
2722
|
|
|
|
2723
|
|
|
// Abort if we hit a combinator |
2724
|
|
|
if ( Expr.relative[ (type = token.type) ] ) { |
2725
|
|
|
break; |
2726
|
|
|
} |
2727
|
|
|
if ( (find = Expr.find[ type ]) ) { |
2728
|
|
|
// Search, expanding context for leading sibling combinators |
2729
|
|
|
if ( (seed = find( |
2730
|
|
|
token.matches[0].replace( runescape, funescape ), |
2731
|
|
|
rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context |
2732
|
|
|
)) ) { |
2733
|
|
|
|
2734
|
|
|
// If seed is empty or no tokens remain, we can return early |
2735
|
|
|
tokens.splice( i, 1 ); |
2736
|
|
|
selector = seed.length && toSelector( tokens ); |
2737
|
|
|
if ( !selector ) { |
2738
|
|
|
push.apply( results, seed ); |
2739
|
|
|
return results; |
2740
|
|
|
} |
2741
|
|
|
|
2742
|
|
|
break; |
2743
|
|
|
} |
2744
|
|
|
} |
2745
|
|
|
} |
2746
|
|
|
} |
2747
|
|
|
|
2748
|
|
|
// Compile and execute a filtering function if one is not provided |
2749
|
|
|
// Provide `match` to avoid retokenization if we modified the selector above |
2750
|
|
|
( compiled || compile( selector, match ) )( |
2751
|
|
|
seed, |
2752
|
|
|
context, |
2753
|
|
|
!documentIsHTML, |
2754
|
|
|
results, |
2755
|
|
|
!context || rsibling.test( selector ) && testContext( context.parentNode ) || context |
2756
|
|
|
); |
2757
|
|
|
return results; |
2758
|
|
|
}; |
2759
|
|
|
|
2760
|
|
|
// One-time assignments |
2761
|
|
|
|
2762
|
|
|
// Sort stability |
2763
|
|
|
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; |
2764
|
|
|
|
2765
|
|
|
// Support: Chrome 14-35+ |
2766
|
|
|
// Always assume duplicates if they aren't passed to the comparison function |
2767
|
|
|
support.detectDuplicates = !!hasDuplicate; |
2768
|
|
|
|
2769
|
|
|
// Initialize against the default document |
2770
|
|
|
setDocument(); |
2771
|
|
|
|
2772
|
|
|
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) |
2773
|
|
|
// Detached nodes confoundingly follow *each other* |
2774
|
|
|
support.sortDetached = assert(function( el ) { |
2775
|
|
|
// Should return 1, but returns 4 (following) |
2776
|
|
|
return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; |
2777
|
|
|
}); |
2778
|
|
|
|
2779
|
|
|
// Support: IE<8 |
2780
|
|
|
// Prevent attribute/property "interpolation" |
2781
|
|
|
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
2782
|
|
|
if ( !assert(function( el ) { |
2783
|
|
|
el.innerHTML = "<a href='#'></a>"; |
2784
|
|
|
return el.firstChild.getAttribute("href") === "#" ; |
2785
|
|
|
}) ) { |
2786
|
|
|
addHandle( "type|href|height|width", function( elem, name, isXML ) { |
2787
|
|
|
if ( !isXML ) { |
2788
|
|
|
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); |
2789
|
|
|
} |
2790
|
|
|
}); |
2791
|
|
|
} |
2792
|
|
|
|
2793
|
|
|
// Support: IE<9 |
2794
|
|
|
// Use defaultValue in place of getAttribute("value") |
2795
|
|
|
if ( !support.attributes || !assert(function( el ) { |
2796
|
|
|
el.innerHTML = "<input/>"; |
2797
|
|
|
el.firstChild.setAttribute( "value", "" ); |
2798
|
|
|
return el.firstChild.getAttribute( "value" ) === ""; |
2799
|
|
|
}) ) { |
2800
|
|
|
addHandle( "value", function( elem, name, isXML ) { |
2801
|
|
|
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { |
2802
|
|
|
return elem.defaultValue; |
2803
|
|
|
} |
2804
|
|
|
}); |
2805
|
|
|
} |
2806
|
|
|
|
2807
|
|
|
// Support: IE<9 |
2808
|
|
|
// Use getAttributeNode to fetch booleans when getAttribute lies |
2809
|
|
|
if ( !assert(function( el ) { |
2810
|
|
|
return el.getAttribute("disabled") == null; |
2811
|
|
|
}) ) { |
2812
|
|
|
addHandle( booleans, function( elem, name, isXML ) { |
2813
|
|
|
var val; |
2814
|
|
|
if ( !isXML ) { |
2815
|
|
|
return elem[ name ] === true ? name.toLowerCase() : |
2816
|
|
|
(val = elem.getAttributeNode( name )) && val.specified ? |
2817
|
|
|
val.value : |
2818
|
|
|
null; |
2819
|
|
|
} |
2820
|
|
|
}); |
2821
|
|
|
} |
2822
|
|
|
|
2823
|
|
|
return Sizzle; |
2824
|
|
|
|
2825
|
|
|
})( window ); |
2826
|
|
|
|
2827
|
|
|
|
2828
|
|
|
|
2829
|
|
|
jQuery.find = Sizzle; |
2830
|
|
|
jQuery.expr = Sizzle.selectors; |
2831
|
|
|
|
2832
|
|
|
// Deprecated |
2833
|
|
|
jQuery.expr[ ":" ] = jQuery.expr.pseudos; |
2834
|
|
|
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; |
2835
|
|
|
jQuery.text = Sizzle.getText; |
2836
|
|
|
jQuery.isXMLDoc = Sizzle.isXML; |
2837
|
|
|
jQuery.contains = Sizzle.contains; |
2838
|
|
|
jQuery.escapeSelector = Sizzle.escape; |
2839
|
|
|
|
2840
|
|
|
|
2841
|
|
|
|
2842
|
|
|
|
2843
|
|
|
var dir = function( elem, dir, until ) { |
2844
|
|
|
var matched = [], |
2845
|
|
|
truncate = until !== undefined; |
2846
|
|
|
|
2847
|
|
|
while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { |
2848
|
|
|
if ( elem.nodeType === 1 ) { |
2849
|
|
|
if ( truncate && jQuery( elem ).is( until ) ) { |
2850
|
|
|
break; |
2851
|
|
|
} |
2852
|
|
|
matched.push( elem ); |
2853
|
|
|
} |
2854
|
|
|
} |
2855
|
|
|
return matched; |
2856
|
|
|
}; |
2857
|
|
|
|
2858
|
|
|
|
2859
|
|
|
var siblings = function( n, elem ) { |
2860
|
|
|
var matched = []; |
2861
|
|
|
|
2862
|
|
|
for ( ; n; n = n.nextSibling ) { |
2863
|
|
|
if ( n.nodeType === 1 && n !== elem ) { |
2864
|
|
|
matched.push( n ); |
2865
|
|
|
} |
2866
|
|
|
} |
2867
|
|
|
|
2868
|
|
|
return matched; |
2869
|
|
|
}; |
2870
|
|
|
|
2871
|
|
|
|
2872
|
|
|
var rneedsContext = jQuery.expr.match.needsContext; |
2873
|
|
|
|
2874
|
|
|
|
2875
|
|
|
|
2876
|
|
|
function nodeName( elem, name ) { |
2877
|
|
|
|
2878
|
|
|
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
2879
|
|
|
|
2880
|
|
|
}; |
2881
|
|
|
var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); |
2882
|
|
|
|
2883
|
|
|
|
2884
|
|
|
|
2885
|
|
|
// Implement the identical functionality for filter and not |
2886
|
|
|
function winnow( elements, qualifier, not ) { |
2887
|
|
|
if ( isFunction( qualifier ) ) { |
2888
|
|
|
return jQuery.grep( elements, function( elem, i ) { |
2889
|
|
|
return !!qualifier.call( elem, i, elem ) !== not; |
2890
|
|
|
} ); |
2891
|
|
|
} |
2892
|
|
|
|
2893
|
|
|
// Single element |
2894
|
|
|
if ( qualifier.nodeType ) { |
2895
|
|
|
return jQuery.grep( elements, function( elem ) { |
2896
|
|
|
return ( elem === qualifier ) !== not; |
2897
|
|
|
} ); |
2898
|
|
|
} |
2899
|
|
|
|
2900
|
|
|
// Arraylike of elements (jQuery, arguments, Array) |
2901
|
|
|
if ( typeof qualifier !== "string" ) { |
2902
|
|
|
return jQuery.grep( elements, function( elem ) { |
2903
|
|
|
return ( indexOf.call( qualifier, elem ) > -1 ) !== not; |
2904
|
|
|
} ); |
2905
|
|
|
} |
2906
|
|
|
|
2907
|
|
|
// Filtered directly for both simple and complex selectors |
2908
|
|
|
return jQuery.filter( qualifier, elements, not ); |
2909
|
|
|
} |
2910
|
|
|
|
2911
|
|
|
jQuery.filter = function( expr, elems, not ) { |
2912
|
|
|
var elem = elems[ 0 ]; |
2913
|
|
|
|
2914
|
|
|
if ( not ) { |
2915
|
|
|
expr = ":not(" + expr + ")"; |
2916
|
|
|
} |
2917
|
|
|
|
2918
|
|
|
if ( elems.length === 1 && elem.nodeType === 1 ) { |
2919
|
|
|
return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; |
2920
|
|
|
} |
2921
|
|
|
|
2922
|
|
|
return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { |
2923
|
|
|
return elem.nodeType === 1; |
2924
|
|
|
} ) ); |
2925
|
|
|
}; |
2926
|
|
|
|
2927
|
|
|
jQuery.fn.extend( { |
2928
|
|
|
find: function( selector ) { |
2929
|
|
|
var i, ret, |
2930
|
|
|
len = this.length, |
2931
|
|
|
self = this; |
2932
|
|
|
|
2933
|
|
|
if ( typeof selector !== "string" ) { |
2934
|
|
|
return this.pushStack( jQuery( selector ).filter( function() { |
2935
|
|
|
for ( i = 0; i < len; i++ ) { |
2936
|
|
|
if ( jQuery.contains( self[ i ], this ) ) { |
2937
|
|
|
return true; |
2938
|
|
|
} |
2939
|
|
|
} |
2940
|
|
|
} ) ); |
2941
|
|
|
} |
2942
|
|
|
|
2943
|
|
|
ret = this.pushStack( [] ); |
2944
|
|
|
|
2945
|
|
|
for ( i = 0; i < len; i++ ) { |
2946
|
|
|
jQuery.find( selector, self[ i ], ret ); |
2947
|
|
|
} |
2948
|
|
|
|
2949
|
|
|
return len > 1 ? jQuery.uniqueSort( ret ) : ret; |
2950
|
|
|
}, |
2951
|
|
|
filter: function( selector ) { |
2952
|
|
|
return this.pushStack( winnow( this, selector || [], false ) ); |
2953
|
|
|
}, |
2954
|
|
|
not: function( selector ) { |
2955
|
|
|
return this.pushStack( winnow( this, selector || [], true ) ); |
2956
|
|
|
}, |
2957
|
|
|
is: function( selector ) { |
2958
|
|
|
return !!winnow( |
2959
|
|
|
this, |
2960
|
|
|
|
2961
|
|
|
// If this is a positional/relative selector, check membership in the returned set |
2962
|
|
|
// so $("p:first").is("p:last") won't return true for a doc with two "p". |
2963
|
|
|
typeof selector === "string" && rneedsContext.test( selector ) ? |
2964
|
|
|
jQuery( selector ) : |
2965
|
|
|
selector || [], |
2966
|
|
|
false |
2967
|
|
|
).length; |
2968
|
|
|
} |
2969
|
|
|
} ); |
2970
|
|
|
|
2971
|
|
|
|
2972
|
|
|
// Initialize a jQuery object |
2973
|
|
|
|
2974
|
|
|
|
2975
|
|
|
// A central reference to the root jQuery(document) |
2976
|
|
|
var rootjQuery, |
2977
|
|
|
|
2978
|
|
|
// A simple way to check for HTML strings |
2979
|
|
|
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
2980
|
|
|
// Strict HTML recognition (#11290: must start with <) |
2981
|
|
|
// Shortcut simple #id case for speed |
2982
|
|
|
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, |
2983
|
|
|
|
2984
|
|
|
init = jQuery.fn.init = function( selector, context, root ) { |
2985
|
|
|
var match, elem; |
2986
|
|
|
|
2987
|
|
|
// HANDLE: $(""), $(null), $(undefined), $(false) |
2988
|
|
|
if ( !selector ) { |
2989
|
|
|
return this; |
2990
|
|
|
} |
2991
|
|
|
|
2992
|
|
|
// Method init() accepts an alternate rootjQuery |
2993
|
|
|
// so migrate can support jQuery.sub (gh-2101) |
2994
|
|
|
root = root || rootjQuery; |
2995
|
|
|
|
2996
|
|
|
// Handle HTML strings |
2997
|
|
|
if ( typeof selector === "string" ) { |
2998
|
|
|
if ( selector[ 0 ] === "<" && |
2999
|
|
|
selector[ selector.length - 1 ] === ">" && |
3000
|
|
|
selector.length >= 3 ) { |
3001
|
|
|
|
3002
|
|
|
// Assume that strings that start and end with <> are HTML and skip the regex check |
3003
|
|
|
match = [ null, selector, null ]; |
3004
|
|
|
|
3005
|
|
|
} else { |
3006
|
|
|
match = rquickExpr.exec( selector ); |
3007
|
|
|
} |
3008
|
|
|
|
3009
|
|
|
// Match html or make sure no context is specified for #id |
3010
|
|
|
if ( match && ( match[ 1 ] || !context ) ) { |
3011
|
|
|
|
3012
|
|
|
// HANDLE: $(html) -> $(array) |
3013
|
|
|
if ( match[ 1 ] ) { |
3014
|
|
|
context = context instanceof jQuery ? context[ 0 ] : context; |
3015
|
|
|
|
3016
|
|
|
// Option to run scripts is true for back-compat |
3017
|
|
|
// Intentionally let the error be thrown if parseHTML is not present |
3018
|
|
|
jQuery.merge( this, jQuery.parseHTML( |
3019
|
|
|
match[ 1 ], |
3020
|
|
|
context && context.nodeType ? context.ownerDocument || context : document, |
3021
|
|
|
true |
3022
|
|
|
) ); |
3023
|
|
|
|
3024
|
|
|
// HANDLE: $(html, props) |
3025
|
|
|
if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { |
3026
|
|
|
for ( match in context ) { |
3027
|
|
|
|
3028
|
|
|
// Properties of context are called as methods if possible |
3029
|
|
|
if ( isFunction( this[ match ] ) ) { |
3030
|
|
|
this[ match ]( context[ match ] ); |
3031
|
|
|
|
3032
|
|
|
// ...and otherwise set as attributes |
3033
|
|
|
} else { |
3034
|
|
|
this.attr( match, context[ match ] ); |
3035
|
|
|
} |
3036
|
|
|
} |
3037
|
|
|
} |
3038
|
|
|
|
3039
|
|
|
return this; |
3040
|
|
|
|
3041
|
|
|
// HANDLE: $(#id) |
3042
|
|
|
} else { |
3043
|
|
|
elem = document.getElementById( match[ 2 ] ); |
3044
|
|
|
|
3045
|
|
|
if ( elem ) { |
3046
|
|
|
|
3047
|
|
|
// Inject the element directly into the jQuery object |
3048
|
|
|
this[ 0 ] = elem; |
3049
|
|
|
this.length = 1; |
3050
|
|
|
} |
3051
|
|
|
return this; |
3052
|
|
|
} |
3053
|
|
|
|
3054
|
|
|
// HANDLE: $(expr, $(...)) |
3055
|
|
|
} else if ( !context || context.jquery ) { |
3056
|
|
|
return ( context || root ).find( selector ); |
3057
|
|
|
|
3058
|
|
|
// HANDLE: $(expr, context) |
3059
|
|
|
// (which is just equivalent to: $(context).find(expr) |
3060
|
|
|
} else { |
3061
|
|
|
return this.constructor( context ).find( selector ); |
3062
|
|
|
} |
3063
|
|
|
|
3064
|
|
|
// HANDLE: $(DOMElement) |
3065
|
|
|
} else if ( selector.nodeType ) { |
3066
|
|
|
this[ 0 ] = selector; |
3067
|
|
|
this.length = 1; |
3068
|
|
|
return this; |
3069
|
|
|
|
3070
|
|
|
// HANDLE: $(function) |
3071
|
|
|
// Shortcut for document ready |
3072
|
|
|
} else if ( isFunction( selector ) ) { |
3073
|
|
|
return root.ready !== undefined ? |
3074
|
|
|
root.ready( selector ) : |
3075
|
|
|
|
3076
|
|
|
// Execute immediately if ready is not present |
3077
|
|
|
selector( jQuery ); |
3078
|
|
|
} |
3079
|
|
|
|
3080
|
|
|
return jQuery.makeArray( selector, this ); |
3081
|
|
|
}; |
3082
|
|
|
|
3083
|
|
|
// Give the init function the jQuery prototype for later instantiation |
3084
|
|
|
init.prototype = jQuery.fn; |
3085
|
|
|
|
3086
|
|
|
// Initialize central reference |
3087
|
|
|
rootjQuery = jQuery( document ); |
3088
|
|
|
|
3089
|
|
|
|
3090
|
|
|
var rparentsprev = /^(?:parents|prev(?:Until|All))/, |
3091
|
|
|
|
3092
|
|
|
// Methods guaranteed to produce a unique set when starting from a unique set |
3093
|
|
|
guaranteedUnique = { |
3094
|
|
|
children: true, |
3095
|
|
|
contents: true, |
3096
|
|
|
next: true, |
3097
|
|
|
prev: true |
3098
|
|
|
}; |
3099
|
|
|
|
3100
|
|
|
jQuery.fn.extend( { |
3101
|
|
|
has: function( target ) { |
3102
|
|
|
var targets = jQuery( target, this ), |
3103
|
|
|
l = targets.length; |
3104
|
|
|
|
3105
|
|
|
return this.filter( function() { |
3106
|
|
|
var i = 0; |
3107
|
|
|
for ( ; i < l; i++ ) { |
3108
|
|
|
if ( jQuery.contains( this, targets[ i ] ) ) { |
3109
|
|
|
return true; |
3110
|
|
|
} |
3111
|
|
|
} |
3112
|
|
|
} ); |
3113
|
|
|
}, |
3114
|
|
|
|
3115
|
|
|
closest: function( selectors, context ) { |
3116
|
|
|
var cur, |
3117
|
|
|
i = 0, |
3118
|
|
|
l = this.length, |
3119
|
|
|
matched = [], |
3120
|
|
|
targets = typeof selectors !== "string" && jQuery( selectors ); |
3121
|
|
|
|
3122
|
|
|
// Positional selectors never match, since there's no _selection_ context |
3123
|
|
|
if ( !rneedsContext.test( selectors ) ) { |
3124
|
|
|
for ( ; i < l; i++ ) { |
3125
|
|
|
for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { |
3126
|
|
|
|
3127
|
|
|
// Always skip document fragments |
3128
|
|
|
if ( cur.nodeType < 11 && ( targets ? |
3129
|
|
|
targets.index( cur ) > -1 : |
3130
|
|
|
|
3131
|
|
|
// Don't pass non-elements to Sizzle |
3132
|
|
|
cur.nodeType === 1 && |
3133
|
|
|
jQuery.find.matchesSelector( cur, selectors ) ) ) { |
3134
|
|
|
|
3135
|
|
|
matched.push( cur ); |
3136
|
|
|
break; |
3137
|
|
|
} |
3138
|
|
|
} |
3139
|
|
|
} |
3140
|
|
|
} |
3141
|
|
|
|
3142
|
|
|
return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); |
3143
|
|
|
}, |
3144
|
|
|
|
3145
|
|
|
// Determine the position of an element within the set |
3146
|
|
|
index: function( elem ) { |
3147
|
|
|
|
3148
|
|
|
// No argument, return index in parent |
3149
|
|
|
if ( !elem ) { |
3150
|
|
|
return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; |
3151
|
|
|
} |
3152
|
|
|
|
3153
|
|
|
// Index in selector |
3154
|
|
|
if ( typeof elem === "string" ) { |
3155
|
|
|
return indexOf.call( jQuery( elem ), this[ 0 ] ); |
3156
|
|
|
} |
3157
|
|
|
|
3158
|
|
|
// Locate the position of the desired element |
3159
|
|
|
return indexOf.call( this, |
3160
|
|
|
|
3161
|
|
|
// If it receives a jQuery object, the first element is used |
3162
|
|
|
elem.jquery ? elem[ 0 ] : elem |
3163
|
|
|
); |
3164
|
|
|
}, |
3165
|
|
|
|
3166
|
|
|
add: function( selector, context ) { |
3167
|
|
|
return this.pushStack( |
3168
|
|
|
jQuery.uniqueSort( |
3169
|
|
|
jQuery.merge( this.get(), jQuery( selector, context ) ) |
3170
|
|
|
) |
3171
|
|
|
); |
3172
|
|
|
}, |
3173
|
|
|
|
3174
|
|
|
addBack: function( selector ) { |
3175
|
|
|
return this.add( selector == null ? |
3176
|
|
|
this.prevObject : this.prevObject.filter( selector ) |
3177
|
|
|
); |
3178
|
|
|
} |
3179
|
|
|
} ); |
3180
|
|
|
|
3181
|
|
|
function sibling( cur, dir ) { |
3182
|
|
|
while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} |
3183
|
|
|
return cur; |
3184
|
|
|
} |
3185
|
|
|
|
3186
|
|
|
jQuery.each( { |
3187
|
|
|
parent: function( elem ) { |
3188
|
|
|
var parent = elem.parentNode; |
3189
|
|
|
return parent && parent.nodeType !== 11 ? parent : null; |
3190
|
|
|
}, |
3191
|
|
|
parents: function( elem ) { |
3192
|
|
|
return dir( elem, "parentNode" ); |
3193
|
|
|
}, |
3194
|
|
|
parentsUntil: function( elem, i, until ) { |
3195
|
|
|
return dir( elem, "parentNode", until ); |
3196
|
|
|
}, |
3197
|
|
|
next: function( elem ) { |
3198
|
|
|
return sibling( elem, "nextSibling" ); |
3199
|
|
|
}, |
3200
|
|
|
prev: function( elem ) { |
3201
|
|
|
return sibling( elem, "previousSibling" ); |
3202
|
|
|
}, |
3203
|
|
|
nextAll: function( elem ) { |
3204
|
|
|
return dir( elem, "nextSibling" ); |
3205
|
|
|
}, |
3206
|
|
|
prevAll: function( elem ) { |
3207
|
|
|
return dir( elem, "previousSibling" ); |
3208
|
|
|
}, |
3209
|
|
|
nextUntil: function( elem, i, until ) { |
3210
|
|
|
return dir( elem, "nextSibling", until ); |
3211
|
|
|
}, |
3212
|
|
|
prevUntil: function( elem, i, until ) { |
3213
|
|
|
return dir( elem, "previousSibling", until ); |
3214
|
|
|
}, |
3215
|
|
|
siblings: function( elem ) { |
3216
|
|
|
return siblings( ( elem.parentNode || {} ).firstChild, elem ); |
3217
|
|
|
}, |
3218
|
|
|
children: function( elem ) { |
3219
|
|
|
return siblings( elem.firstChild ); |
3220
|
|
|
}, |
3221
|
|
|
contents: function( elem ) { |
3222
|
|
|
if ( nodeName( elem, "iframe" ) ) { |
3223
|
|
|
return elem.contentDocument; |
3224
|
|
|
} |
3225
|
|
|
|
3226
|
|
|
// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only |
3227
|
|
|
// Treat the template element as a regular one in browsers that |
3228
|
|
|
// don't support it. |
3229
|
|
|
if ( nodeName( elem, "template" ) ) { |
3230
|
|
|
elem = elem.content || elem; |
3231
|
|
|
} |
3232
|
|
|
|
3233
|
|
|
return jQuery.merge( [], elem.childNodes ); |
3234
|
|
|
} |
3235
|
|
|
}, function( name, fn ) { |
3236
|
|
|
jQuery.fn[ name ] = function( until, selector ) { |
3237
|
|
|
var matched = jQuery.map( this, fn, until ); |
3238
|
|
|
|
3239
|
|
|
if ( name.slice( -5 ) !== "Until" ) { |
3240
|
|
|
selector = until; |
3241
|
|
|
} |
3242
|
|
|
|
3243
|
|
|
if ( selector && typeof selector === "string" ) { |
3244
|
|
|
matched = jQuery.filter( selector, matched ); |
3245
|
|
|
} |
3246
|
|
|
|
3247
|
|
|
if ( this.length > 1 ) { |
3248
|
|
|
|
3249
|
|
|
// Remove duplicates |
3250
|
|
|
if ( !guaranteedUnique[ name ] ) { |
3251
|
|
|
jQuery.uniqueSort( matched ); |
3252
|
|
|
} |
3253
|
|
|
|
3254
|
|
|
// Reverse order for parents* and prev-derivatives |
3255
|
|
|
if ( rparentsprev.test( name ) ) { |
3256
|
|
|
matched.reverse(); |
3257
|
|
|
} |
3258
|
|
|
} |
3259
|
|
|
|
3260
|
|
|
return this.pushStack( matched ); |
3261
|
|
|
}; |
3262
|
|
|
} ); |
3263
|
|
|
var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); |
3264
|
|
|
|
3265
|
|
|
|
3266
|
|
|
|
3267
|
|
|
// Convert String-formatted options into Object-formatted ones |
3268
|
|
|
function createOptions( options ) { |
3269
|
|
|
var object = {}; |
3270
|
|
|
jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { |
3271
|
|
|
object[ flag ] = true; |
3272
|
|
|
} ); |
3273
|
|
|
return object; |
3274
|
|
|
} |
3275
|
|
|
|
3276
|
|
|
/* |
3277
|
|
|
* Create a callback list using the following parameters: |
3278
|
|
|
* |
3279
|
|
|
* options: an optional list of space-separated options that will change how |
3280
|
|
|
* the callback list behaves or a more traditional option object |
3281
|
|
|
* |
3282
|
|
|
* By default a callback list will act like an event callback list and can be |
3283
|
|
|
* "fired" multiple times. |
3284
|
|
|
* |
3285
|
|
|
* Possible options: |
3286
|
|
|
* |
3287
|
|
|
* once: will ensure the callback list can only be fired once (like a Deferred) |
3288
|
|
|
* |
3289
|
|
|
* memory: will keep track of previous values and will call any callback added |
3290
|
|
|
* after the list has been fired right away with the latest "memorized" |
3291
|
|
|
* values (like a Deferred) |
3292
|
|
|
* |
3293
|
|
|
* unique: will ensure a callback can only be added once (no duplicate in the list) |
3294
|
|
|
* |
3295
|
|
|
* stopOnFalse: interrupt callings when a callback returns false |
3296
|
|
|
* |
3297
|
|
|
*/ |
3298
|
|
|
jQuery.Callbacks = function( options ) { |
3299
|
|
|
|
3300
|
|
|
// Convert options from String-formatted to Object-formatted if needed |
3301
|
|
|
// (we check in cache first) |
3302
|
|
|
options = typeof options === "string" ? |
3303
|
|
|
createOptions( options ) : |
3304
|
|
|
jQuery.extend( {}, options ); |
3305
|
|
|
|
3306
|
|
|
var // Flag to know if list is currently firing |
3307
|
|
|
firing, |
3308
|
|
|
|
3309
|
|
|
// Last fire value for non-forgettable lists |
3310
|
|
|
memory, |
3311
|
|
|
|
3312
|
|
|
// Flag to know if list was already fired |
3313
|
|
|
fired, |
3314
|
|
|
|
3315
|
|
|
// Flag to prevent firing |
3316
|
|
|
locked, |
3317
|
|
|
|
3318
|
|
|
// Actual callback list |
3319
|
|
|
list = [], |
3320
|
|
|
|
3321
|
|
|
// Queue of execution data for repeatable lists |
3322
|
|
|
queue = [], |
3323
|
|
|
|
3324
|
|
|
// Index of currently firing callback (modified by add/remove as needed) |
3325
|
|
|
firingIndex = -1, |
3326
|
|
|
|
3327
|
|
|
// Fire callbacks |
3328
|
|
|
fire = function() { |
3329
|
|
|
|
3330
|
|
|
// Enforce single-firing |
3331
|
|
|
locked = locked || options.once; |
3332
|
|
|
|
3333
|
|
|
// Execute callbacks for all pending executions, |
3334
|
|
|
// respecting firingIndex overrides and runtime changes |
3335
|
|
|
fired = firing = true; |
3336
|
|
|
for ( ; queue.length; firingIndex = -1 ) { |
3337
|
|
|
memory = queue.shift(); |
3338
|
|
|
while ( ++firingIndex < list.length ) { |
3339
|
|
|
|
3340
|
|
|
// Run callback and check for early termination |
3341
|
|
|
if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && |
3342
|
|
|
options.stopOnFalse ) { |
3343
|
|
|
|
3344
|
|
|
// Jump to end and forget the data so .add doesn't re-fire |
3345
|
|
|
firingIndex = list.length; |
3346
|
|
|
memory = false; |
3347
|
|
|
} |
3348
|
|
|
} |
3349
|
|
|
} |
3350
|
|
|
|
3351
|
|
|
// Forget the data if we're done with it |
3352
|
|
|
if ( !options.memory ) { |
3353
|
|
|
memory = false; |
3354
|
|
|
} |
3355
|
|
|
|
3356
|
|
|
firing = false; |
3357
|
|
|
|
3358
|
|
|
// Clean up if we're done firing for good |
3359
|
|
|
if ( locked ) { |
3360
|
|
|
|
3361
|
|
|
// Keep an empty list if we have data for future add calls |
3362
|
|
|
if ( memory ) { |
3363
|
|
|
list = []; |
3364
|
|
|
|
3365
|
|
|
// Otherwise, this object is spent |
3366
|
|
|
} else { |
3367
|
|
|
list = ""; |
3368
|
|
|
} |
3369
|
|
|
} |
3370
|
|
|
}, |
3371
|
|
|
|
3372
|
|
|
// Actual Callbacks object |
3373
|
|
|
self = { |
3374
|
|
|
|
3375
|
|
|
// Add a callback or a collection of callbacks to the list |
3376
|
|
|
add: function() { |
3377
|
|
|
if ( list ) { |
3378
|
|
|
|
3379
|
|
|
// If we have memory from a past run, we should fire after adding |
3380
|
|
|
if ( memory && !firing ) { |
3381
|
|
|
firingIndex = list.length - 1; |
3382
|
|
|
queue.push( memory ); |
3383
|
|
|
} |
3384
|
|
|
|
3385
|
|
|
( function add( args ) { |
3386
|
|
|
jQuery.each( args, function( _, arg ) { |
3387
|
|
|
if ( isFunction( arg ) ) { |
3388
|
|
|
if ( !options.unique || !self.has( arg ) ) { |
3389
|
|
|
list.push( arg ); |
3390
|
|
|
} |
3391
|
|
|
} else if ( arg && arg.length && toType( arg ) !== "string" ) { |
3392
|
|
|
|
3393
|
|
|
// Inspect recursively |
3394
|
|
|
add( arg ); |
3395
|
|
|
} |
3396
|
|
|
} ); |
3397
|
|
|
} )( arguments ); |
3398
|
|
|
|
3399
|
|
|
if ( memory && !firing ) { |
3400
|
|
|
fire(); |
3401
|
|
|
} |
3402
|
|
|
} |
3403
|
|
|
return this; |
3404
|
|
|
}, |
3405
|
|
|
|
3406
|
|
|
// Remove a callback from the list |
3407
|
|
|
remove: function() { |
3408
|
|
|
jQuery.each( arguments, function( _, arg ) { |
3409
|
|
|
var index; |
3410
|
|
|
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { |
3411
|
|
|
list.splice( index, 1 ); |
3412
|
|
|
|
3413
|
|
|
// Handle firing indexes |
3414
|
|
|
if ( index <= firingIndex ) { |
3415
|
|
|
firingIndex--; |
3416
|
|
|
} |
3417
|
|
|
} |
3418
|
|
|
} ); |
3419
|
|
|
return this; |
3420
|
|
|
}, |
3421
|
|
|
|
3422
|
|
|
// Check if a given callback is in the list. |
3423
|
|
|
// If no argument is given, return whether or not list has callbacks attached. |
3424
|
|
|
has: function( fn ) { |
3425
|
|
|
return fn ? |
3426
|
|
|
jQuery.inArray( fn, list ) > -1 : |
3427
|
|
|
list.length > 0; |
3428
|
|
|
}, |
3429
|
|
|
|
3430
|
|
|
// Remove all callbacks from the list |
3431
|
|
|
empty: function() { |
3432
|
|
|
if ( list ) { |
3433
|
|
|
list = []; |
3434
|
|
|
} |
3435
|
|
|
return this; |
3436
|
|
|
}, |
3437
|
|
|
|
3438
|
|
|
// Disable .fire and .add |
3439
|
|
|
// Abort any current/pending executions |
3440
|
|
|
// Clear all callbacks and values |
3441
|
|
|
disable: function() { |
3442
|
|
|
locked = queue = []; |
3443
|
|
|
list = memory = ""; |
3444
|
|
|
return this; |
3445
|
|
|
}, |
3446
|
|
|
disabled: function() { |
3447
|
|
|
return !list; |
3448
|
|
|
}, |
3449
|
|
|
|
3450
|
|
|
// Disable .fire |
3451
|
|
|
// Also disable .add unless we have memory (since it would have no effect) |
3452
|
|
|
// Abort any pending executions |
3453
|
|
|
lock: function() { |
3454
|
|
|
locked = queue = []; |
3455
|
|
|
if ( !memory && !firing ) { |
3456
|
|
|
list = memory = ""; |
3457
|
|
|
} |
3458
|
|
|
return this; |
3459
|
|
|
}, |
3460
|
|
|
locked: function() { |
3461
|
|
|
return !!locked; |
3462
|
|
|
}, |
3463
|
|
|
|
3464
|
|
|
// Call all callbacks with the given context and arguments |
3465
|
|
|
fireWith: function( context, args ) { |
3466
|
|
|
if ( !locked ) { |
3467
|
|
|
args = args || []; |
3468
|
|
|
args = [ context, args.slice ? args.slice() : args ]; |
3469
|
|
|
queue.push( args ); |
3470
|
|
|
if ( !firing ) { |
3471
|
|
|
fire(); |
3472
|
|
|
} |
3473
|
|
|
} |
3474
|
|
|
return this; |
3475
|
|
|
}, |
3476
|
|
|
|
3477
|
|
|
// Call all the callbacks with the given arguments |
3478
|
|
|
fire: function() { |
3479
|
|
|
self.fireWith( this, arguments ); |
3480
|
|
|
return this; |
3481
|
|
|
}, |
3482
|
|
|
|
3483
|
|
|
// To know if the callbacks have already been called at least once |
3484
|
|
|
fired: function() { |
3485
|
|
|
return !!fired; |
3486
|
|
|
} |
3487
|
|
|
}; |
3488
|
|
|
|
3489
|
|
|
return self; |
3490
|
|
|
}; |
3491
|
|
|
|
3492
|
|
|
|
3493
|
|
|
function Identity( v ) { |
3494
|
|
|
return v; |
3495
|
|
|
} |
3496
|
|
|
function Thrower( ex ) { |
3497
|
|
|
throw ex; |
3498
|
|
|
} |
3499
|
|
|
|
3500
|
|
|
function adoptValue( value, resolve, reject, noValue ) { |
3501
|
|
|
var method; |
3502
|
|
|
|
3503
|
|
|
try { |
3504
|
|
|
|
3505
|
|
|
// Check for promise aspect first to privilege synchronous behavior |
3506
|
|
|
if ( value && isFunction( ( method = value.promise ) ) ) { |
3507
|
|
|
method.call( value ).done( resolve ).fail( reject ); |
3508
|
|
|
|
3509
|
|
|
// Other thenables |
3510
|
|
|
} else if ( value && isFunction( ( method = value.then ) ) ) { |
3511
|
|
|
method.call( value, resolve, reject ); |
3512
|
|
|
|
3513
|
|
|
// Other non-thenables |
3514
|
|
|
} else { |
3515
|
|
|
|
3516
|
|
|
// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: |
3517
|
|
|
// * false: [ value ].slice( 0 ) => resolve( value ) |
3518
|
|
|
// * true: [ value ].slice( 1 ) => resolve() |
3519
|
|
|
resolve.apply( undefined, [ value ].slice( noValue ) ); |
3520
|
|
|
} |
3521
|
|
|
|
3522
|
|
|
// For Promises/A+, convert exceptions into rejections |
3523
|
|
|
// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in |
3524
|
|
|
// Deferred#then to conditionally suppress rejection. |
3525
|
|
|
} catch ( value ) { |
3526
|
|
|
|
3527
|
|
|
// Support: Android 4.0 only |
3528
|
|
|
// Strict mode functions invoked without .call/.apply get global-object context |
3529
|
|
|
reject.apply( undefined, [ value ] ); |
3530
|
|
|
} |
3531
|
|
|
} |
3532
|
|
|
|
3533
|
|
|
jQuery.extend( { |
3534
|
|
|
|
3535
|
|
|
Deferred: function( func ) { |
3536
|
|
|
var tuples = [ |
3537
|
|
|
|
3538
|
|
|
// action, add listener, callbacks, |
3539
|
|
|
// ... .then handlers, argument index, [final state] |
3540
|
|
|
[ "notify", "progress", jQuery.Callbacks( "memory" ), |
3541
|
|
|
jQuery.Callbacks( "memory" ), 2 ], |
3542
|
|
|
[ "resolve", "done", jQuery.Callbacks( "once memory" ), |
3543
|
|
|
jQuery.Callbacks( "once memory" ), 0, "resolved" ], |
3544
|
|
|
[ "reject", "fail", jQuery.Callbacks( "once memory" ), |
3545
|
|
|
jQuery.Callbacks( "once memory" ), 1, "rejected" ] |
3546
|
|
|
], |
3547
|
|
|
state = "pending", |
3548
|
|
|
promise = { |
3549
|
|
|
state: function() { |
3550
|
|
|
return state; |
3551
|
|
|
}, |
3552
|
|
|
always: function() { |
3553
|
|
|
deferred.done( arguments ).fail( arguments ); |
3554
|
|
|
return this; |
3555
|
|
|
}, |
3556
|
|
|
"catch": function( fn ) { |
3557
|
|
|
return promise.then( null, fn ); |
3558
|
|
|
}, |
3559
|
|
|
|
3560
|
|
|
// Keep pipe for back-compat |
3561
|
|
|
pipe: function( /* fnDone, fnFail, fnProgress */ ) { |
3562
|
|
|
var fns = arguments; |
3563
|
|
|
|
3564
|
|
|
return jQuery.Deferred( function( newDefer ) { |
3565
|
|
|
jQuery.each( tuples, function( i, tuple ) { |
3566
|
|
|
|
3567
|
|
|
// Map tuples (progress, done, fail) to arguments (done, fail, progress) |
3568
|
|
|
var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; |
3569
|
|
|
|
3570
|
|
|
// deferred.progress(function() { bind to newDefer or newDefer.notify }) |
3571
|
|
|
// deferred.done(function() { bind to newDefer or newDefer.resolve }) |
3572
|
|
|
// deferred.fail(function() { bind to newDefer or newDefer.reject }) |
3573
|
|
|
deferred[ tuple[ 1 ] ]( function() { |
3574
|
|
|
var returned = fn && fn.apply( this, arguments ); |
3575
|
|
|
if ( returned && isFunction( returned.promise ) ) { |
3576
|
|
|
returned.promise() |
3577
|
|
|
.progress( newDefer.notify ) |
3578
|
|
|
.done( newDefer.resolve ) |
3579
|
|
|
.fail( newDefer.reject ); |
3580
|
|
|
} else { |
3581
|
|
|
newDefer[ tuple[ 0 ] + "With" ]( |
3582
|
|
|
this, |
3583
|
|
|
fn ? [ returned ] : arguments |
3584
|
|
|
); |
3585
|
|
|
} |
3586
|
|
|
} ); |
3587
|
|
|
} ); |
3588
|
|
|
fns = null; |
3589
|
|
|
} ).promise(); |
3590
|
|
|
}, |
3591
|
|
|
then: function( onFulfilled, onRejected, onProgress ) { |
3592
|
|
|
var maxDepth = 0; |
3593
|
|
|
function resolve( depth, deferred, handler, special ) { |
3594
|
|
|
return function() { |
3595
|
|
|
var that = this, |
3596
|
|
|
args = arguments, |
3597
|
|
|
mightThrow = function() { |
3598
|
|
|
var returned, then; |
3599
|
|
|
|
3600
|
|
|
// Support: Promises/A+ section 2.3.3.3.3 |
3601
|
|
|
// https://promisesaplus.com/#point-59 |
3602
|
|
|
// Ignore double-resolution attempts |
3603
|
|
|
if ( depth < maxDepth ) { |
3604
|
|
|
return; |
3605
|
|
|
} |
3606
|
|
|
|
3607
|
|
|
returned = handler.apply( that, args ); |
3608
|
|
|
|
3609
|
|
|
// Support: Promises/A+ section 2.3.1 |
3610
|
|
|
// https://promisesaplus.com/#point-48 |
3611
|
|
|
if ( returned === deferred.promise() ) { |
3612
|
|
|
throw new TypeError( "Thenable self-resolution" ); |
3613
|
|
|
} |
3614
|
|
|
|
3615
|
|
|
// Support: Promises/A+ sections 2.3.3.1, 3.5 |
3616
|
|
|
// https://promisesaplus.com/#point-54 |
3617
|
|
|
// https://promisesaplus.com/#point-75 |
3618
|
|
|
// Retrieve `then` only once |
3619
|
|
|
then = returned && |
3620
|
|
|
|
3621
|
|
|
// Support: Promises/A+ section 2.3.4 |
3622
|
|
|
// https://promisesaplus.com/#point-64 |
3623
|
|
|
// Only check objects and functions for thenability |
3624
|
|
|
( typeof returned === "object" || |
3625
|
|
|
typeof returned === "function" ) && |
3626
|
|
|
returned.then; |
3627
|
|
|
|
3628
|
|
|
// Handle a returned thenable |
3629
|
|
|
if ( isFunction( then ) ) { |
3630
|
|
|
|
3631
|
|
|
// Special processors (notify) just wait for resolution |
3632
|
|
|
if ( special ) { |
3633
|
|
|
then.call( |
3634
|
|
|
returned, |
3635
|
|
|
resolve( maxDepth, deferred, Identity, special ), |
3636
|
|
|
resolve( maxDepth, deferred, Thrower, special ) |
3637
|
|
|
); |
3638
|
|
|
|
3639
|
|
|
// Normal processors (resolve) also hook into progress |
3640
|
|
|
} else { |
3641
|
|
|
|
3642
|
|
|
// ...and disregard older resolution values |
3643
|
|
|
maxDepth++; |
3644
|
|
|
|
3645
|
|
|
then.call( |
3646
|
|
|
returned, |
3647
|
|
|
resolve( maxDepth, deferred, Identity, special ), |
3648
|
|
|
resolve( maxDepth, deferred, Thrower, special ), |
3649
|
|
|
resolve( maxDepth, deferred, Identity, |
3650
|
|
|
deferred.notifyWith ) |
3651
|
|
|
); |
3652
|
|
|
} |
3653
|
|
|
|
3654
|
|
|
// Handle all other returned values |
3655
|
|
|
} else { |
3656
|
|
|
|
3657
|
|
|
// Only substitute handlers pass on context |
3658
|
|
|
// and multiple values (non-spec behavior) |
3659
|
|
|
if ( handler !== Identity ) { |
3660
|
|
|
that = undefined; |
3661
|
|
|
args = [ returned ]; |
3662
|
|
|
} |
3663
|
|
|
|
3664
|
|
|
// Process the value(s) |
3665
|
|
|
// Default process is resolve |
3666
|
|
|
( special || deferred.resolveWith )( that, args ); |
3667
|
|
|
} |
3668
|
|
|
}, |
3669
|
|
|
|
3670
|
|
|
// Only normal processors (resolve) catch and reject exceptions |
3671
|
|
|
process = special ? |
3672
|
|
|
mightThrow : |
3673
|
|
|
function() { |
3674
|
|
|
try { |
3675
|
|
|
mightThrow(); |
3676
|
|
|
} catch ( e ) { |
3677
|
|
|
|
3678
|
|
|
if ( jQuery.Deferred.exceptionHook ) { |
3679
|
|
|
jQuery.Deferred.exceptionHook( e, |
3680
|
|
|
process.stackTrace ); |
3681
|
|
|
} |
3682
|
|
|
|
3683
|
|
|
// Support: Promises/A+ section 2.3.3.3.4.1 |
3684
|
|
|
// https://promisesaplus.com/#point-61 |
3685
|
|
|
// Ignore post-resolution exceptions |
3686
|
|
|
if ( depth + 1 >= maxDepth ) { |
3687
|
|
|
|
3688
|
|
|
// Only substitute handlers pass on context |
3689
|
|
|
// and multiple values (non-spec behavior) |
3690
|
|
|
if ( handler !== Thrower ) { |
3691
|
|
|
that = undefined; |
3692
|
|
|
args = [ e ]; |
3693
|
|
|
} |
3694
|
|
|
|
3695
|
|
|
deferred.rejectWith( that, args ); |
3696
|
|
|
} |
3697
|
|
|
} |
3698
|
|
|
}; |
3699
|
|
|
|
3700
|
|
|
// Support: Promises/A+ section 2.3.3.3.1 |
3701
|
|
|
// https://promisesaplus.com/#point-57 |
3702
|
|
|
// Re-resolve promises immediately to dodge false rejection from |
3703
|
|
|
// subsequent errors |
3704
|
|
|
if ( depth ) { |
3705
|
|
|
process(); |
3706
|
|
|
} else { |
3707
|
|
|
|
3708
|
|
|
// Call an optional hook to record the stack, in case of exception |
3709
|
|
|
// since it's otherwise lost when execution goes async |
3710
|
|
|
if ( jQuery.Deferred.getStackHook ) { |
3711
|
|
|
process.stackTrace = jQuery.Deferred.getStackHook(); |
3712
|
|
|
} |
3713
|
|
|
window.setTimeout( process ); |
3714
|
|
|
} |
3715
|
|
|
}; |
3716
|
|
|
} |
3717
|
|
|
|
3718
|
|
|
return jQuery.Deferred( function( newDefer ) { |
3719
|
|
|
|
3720
|
|
|
// progress_handlers.add( ... ) |
3721
|
|
|
tuples[ 0 ][ 3 ].add( |
3722
|
|
|
resolve( |
3723
|
|
|
0, |
3724
|
|
|
newDefer, |
3725
|
|
|
isFunction( onProgress ) ? |
3726
|
|
|
onProgress : |
3727
|
|
|
Identity, |
3728
|
|
|
newDefer.notifyWith |
3729
|
|
|
) |
3730
|
|
|
); |
3731
|
|
|
|
3732
|
|
|
// fulfilled_handlers.add( ... ) |
3733
|
|
|
tuples[ 1 ][ 3 ].add( |
3734
|
|
|
resolve( |
3735
|
|
|
0, |
3736
|
|
|
newDefer, |
3737
|
|
|
isFunction( onFulfilled ) ? |
3738
|
|
|
onFulfilled : |
3739
|
|
|
Identity |
3740
|
|
|
) |
3741
|
|
|
); |
3742
|
|
|
|
3743
|
|
|
// rejected_handlers.add( ... ) |
3744
|
|
|
tuples[ 2 ][ 3 ].add( |
3745
|
|
|
resolve( |
3746
|
|
|
0, |
3747
|
|
|
newDefer, |
3748
|
|
|
isFunction( onRejected ) ? |
3749
|
|
|
onRejected : |
3750
|
|
|
Thrower |
3751
|
|
|
) |
3752
|
|
|
); |
3753
|
|
|
} ).promise(); |
3754
|
|
|
}, |
3755
|
|
|
|
3756
|
|
|
// Get a promise for this deferred |
3757
|
|
|
// If obj is provided, the promise aspect is added to the object |
3758
|
|
|
promise: function( obj ) { |
3759
|
|
|
return obj != null ? jQuery.extend( obj, promise ) : promise; |
3760
|
|
|
} |
3761
|
|
|
}, |
3762
|
|
|
deferred = {}; |
3763
|
|
|
|
3764
|
|
|
// Add list-specific methods |
3765
|
|
|
jQuery.each( tuples, function( i, tuple ) { |
3766
|
|
|
var list = tuple[ 2 ], |
3767
|
|
|
stateString = tuple[ 5 ]; |
3768
|
|
|
|
3769
|
|
|
// promise.progress = list.add |
3770
|
|
|
// promise.done = list.add |
3771
|
|
|
// promise.fail = list.add |
3772
|
|
|
promise[ tuple[ 1 ] ] = list.add; |
3773
|
|
|
|
3774
|
|
|
// Handle state |
3775
|
|
|
if ( stateString ) { |
3776
|
|
|
list.add( |
3777
|
|
|
function() { |
3778
|
|
|
|
3779
|
|
|
// state = "resolved" (i.e., fulfilled) |
3780
|
|
|
// state = "rejected" |
3781
|
|
|
state = stateString; |
3782
|
|
|
}, |
3783
|
|
|
|
3784
|
|
|
// rejected_callbacks.disable |
3785
|
|
|
// fulfilled_callbacks.disable |
3786
|
|
|
tuples[ 3 - i ][ 2 ].disable, |
3787
|
|
|
|
3788
|
|
|
// rejected_handlers.disable |
3789
|
|
|
// fulfilled_handlers.disable |
3790
|
|
|
tuples[ 3 - i ][ 3 ].disable, |
3791
|
|
|
|
3792
|
|
|
// progress_callbacks.lock |
3793
|
|
|
tuples[ 0 ][ 2 ].lock, |
3794
|
|
|
|
3795
|
|
|
// progress_handlers.lock |
3796
|
|
|
tuples[ 0 ][ 3 ].lock |
3797
|
|
|
); |
3798
|
|
|
} |
3799
|
|
|
|
3800
|
|
|
// progress_handlers.fire |
3801
|
|
|
// fulfilled_handlers.fire |
3802
|
|
|
// rejected_handlers.fire |
3803
|
|
|
list.add( tuple[ 3 ].fire ); |
3804
|
|
|
|
3805
|
|
|
// deferred.notify = function() { deferred.notifyWith(...) } |
3806
|
|
|
// deferred.resolve = function() { deferred.resolveWith(...) } |
3807
|
|
|
// deferred.reject = function() { deferred.rejectWith(...) } |
3808
|
|
|
deferred[ tuple[ 0 ] ] = function() { |
3809
|
|
|
deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); |
3810
|
|
|
return this; |
3811
|
|
|
}; |
3812
|
|
|
|
3813
|
|
|
// deferred.notifyWith = list.fireWith |
3814
|
|
|
// deferred.resolveWith = list.fireWith |
3815
|
|
|
// deferred.rejectWith = list.fireWith |
3816
|
|
|
deferred[ tuple[ 0 ] + "With" ] = list.fireWith; |
3817
|
|
|
} ); |
3818
|
|
|
|
3819
|
|
|
// Make the deferred a promise |
3820
|
|
|
promise.promise( deferred ); |
3821
|
|
|
|
3822
|
|
|
// Call given func if any |
3823
|
|
|
if ( func ) { |
3824
|
|
|
func.call( deferred, deferred ); |
3825
|
|
|
} |
3826
|
|
|
|
3827
|
|
|
// All done! |
3828
|
|
|
return deferred; |
3829
|
|
|
}, |
3830
|
|
|
|
3831
|
|
|
// Deferred helper |
3832
|
|
|
when: function( singleValue ) { |
3833
|
|
|
var |
3834
|
|
|
|
3835
|
|
|
// count of uncompleted subordinates |
3836
|
|
|
remaining = arguments.length, |
3837
|
|
|
|
3838
|
|
|
// count of unprocessed arguments |
3839
|
|
|
i = remaining, |
3840
|
|
|
|
3841
|
|
|
// subordinate fulfillment data |
3842
|
|
|
resolveContexts = Array( i ), |
3843
|
|
|
resolveValues = slice.call( arguments ), |
3844
|
|
|
|
3845
|
|
|
// the master Deferred |
3846
|
|
|
master = jQuery.Deferred(), |
3847
|
|
|
|
3848
|
|
|
// subordinate callback factory |
3849
|
|
|
updateFunc = function( i ) { |
3850
|
|
|
return function( value ) { |
3851
|
|
|
resolveContexts[ i ] = this; |
3852
|
|
|
resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; |
3853
|
|
|
if ( !( --remaining ) ) { |
3854
|
|
|
master.resolveWith( resolveContexts, resolveValues ); |
3855
|
|
|
} |
3856
|
|
|
}; |
3857
|
|
|
}; |
3858
|
|
|
|
3859
|
|
|
// Single- and empty arguments are adopted like Promise.resolve |
3860
|
|
|
if ( remaining <= 1 ) { |
3861
|
|
|
adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, |
3862
|
|
|
!remaining ); |
3863
|
|
|
|
3864
|
|
|
// Use .then() to unwrap secondary thenables (cf. gh-3000) |
3865
|
|
|
if ( master.state() === "pending" || |
3866
|
|
|
isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { |
3867
|
|
|
|
3868
|
|
|
return master.then(); |
3869
|
|
|
} |
3870
|
|
|
} |
3871
|
|
|
|
3872
|
|
|
// Multiple arguments are aggregated like Promise.all array elements |
3873
|
|
|
while ( i-- ) { |
3874
|
|
|
adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); |
3875
|
|
|
} |
3876
|
|
|
|
3877
|
|
|
return master.promise(); |
3878
|
|
|
} |
3879
|
|
|
} ); |
3880
|
|
|
|
3881
|
|
|
|
3882
|
|
|
// These usually indicate a programmer mistake during development, |
3883
|
|
|
// warn about them ASAP rather than swallowing them by default. |
3884
|
|
|
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; |
3885
|
|
|
|
3886
|
|
|
jQuery.Deferred.exceptionHook = function( error, stack ) { |
3887
|
|
|
|
3888
|
|
|
// Support: IE 8 - 9 only |
3889
|
|
|
// Console exists when dev tools are open, which can happen at any time |
3890
|
|
|
if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { |
3891
|
|
|
window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); |
3892
|
|
|
} |
3893
|
|
|
}; |
3894
|
|
|
|
3895
|
|
|
|
3896
|
|
|
|
3897
|
|
|
|
3898
|
|
|
jQuery.readyException = function( error ) { |
3899
|
|
|
window.setTimeout( function() { |
3900
|
|
|
throw error; |
3901
|
|
|
} ); |
3902
|
|
|
}; |
3903
|
|
|
|
3904
|
|
|
|
3905
|
|
|
|
3906
|
|
|
|
3907
|
|
|
// The deferred used on DOM ready |
3908
|
|
|
var readyList = jQuery.Deferred(); |
3909
|
|
|
|
3910
|
|
|
jQuery.fn.ready = function( fn ) { |
3911
|
|
|
|
3912
|
|
|
readyList |
3913
|
|
|
.then( fn ) |
3914
|
|
|
|
3915
|
|
|
// Wrap jQuery.readyException in a function so that the lookup |
3916
|
|
|
// happens at the time of error handling instead of callback |
3917
|
|
|
// registration. |
3918
|
|
|
.catch( function( error ) { |
3919
|
|
|
jQuery.readyException( error ); |
3920
|
|
|
} ); |
3921
|
|
|
|
3922
|
|
|
return this; |
3923
|
|
|
}; |
3924
|
|
|
|
3925
|
|
|
jQuery.extend( { |
3926
|
|
|
|
3927
|
|
|
// Is the DOM ready to be used? Set to true once it occurs. |
3928
|
|
|
isReady: false, |
3929
|
|
|
|
3930
|
|
|
// A counter to track how many items to wait for before |
3931
|
|
|
// the ready event fires. See #6781 |
3932
|
|
|
readyWait: 1, |
3933
|
|
|
|
3934
|
|
|
// Handle when the DOM is ready |
3935
|
|
|
ready: function( wait ) { |
3936
|
|
|
|
3937
|
|
|
// Abort if there are pending holds or we're already ready |
3938
|
|
|
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
3939
|
|
|
return; |
3940
|
|
|
} |
3941
|
|
|
|
3942
|
|
|
// Remember that the DOM is ready |
3943
|
|
|
jQuery.isReady = true; |
3944
|
|
|
|
3945
|
|
|
// If a normal DOM Ready event fired, decrement, and wait if need be |
3946
|
|
|
if ( wait !== true && --jQuery.readyWait > 0 ) { |
3947
|
|
|
return; |
3948
|
|
|
} |
3949
|
|
|
|
3950
|
|
|
// If there are functions bound, to execute |
3951
|
|
|
readyList.resolveWith( document, [ jQuery ] ); |
3952
|
|
|
} |
3953
|
|
|
} ); |
3954
|
|
|
|
3955
|
|
|
jQuery.ready.then = readyList.then; |
3956
|
|
|
|
3957
|
|
|
// The ready event handler and self cleanup method |
3958
|
|
|
function completed() { |
3959
|
|
|
document.removeEventListener( "DOMContentLoaded", completed ); |
3960
|
|
|
window.removeEventListener( "load", completed ); |
3961
|
|
|
jQuery.ready(); |
3962
|
|
|
} |
3963
|
|
|
|
3964
|
|
|
// Catch cases where $(document).ready() is called |
3965
|
|
|
// after the browser event has already occurred. |
3966
|
|
|
// Support: IE <=9 - 10 only |
3967
|
|
|
// Older IE sometimes signals "interactive" too soon |
3968
|
|
|
if ( document.readyState === "complete" || |
3969
|
|
|
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { |
3970
|
|
|
|
3971
|
|
|
// Handle it asynchronously to allow scripts the opportunity to delay ready |
3972
|
|
|
window.setTimeout( jQuery.ready ); |
3973
|
|
|
|
3974
|
|
|
} else { |
3975
|
|
|
|
3976
|
|
|
// Use the handy event callback |
3977
|
|
|
document.addEventListener( "DOMContentLoaded", completed ); |
3978
|
|
|
|
3979
|
|
|
// A fallback to window.onload, that will always work |
3980
|
|
|
window.addEventListener( "load", completed ); |
3981
|
|
|
} |
3982
|
|
|
|
3983
|
|
|
|
3984
|
|
|
|
3985
|
|
|
|
3986
|
|
|
// Multifunctional method to get and set values of a collection |
3987
|
|
|
// The value/s can optionally be executed if it's a function |
3988
|
|
|
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { |
3989
|
|
|
var i = 0, |
3990
|
|
|
len = elems.length, |
3991
|
|
|
bulk = key == null; |
3992
|
|
|
|
3993
|
|
|
// Sets many values |
3994
|
|
|
if ( toType( key ) === "object" ) { |
3995
|
|
|
chainable = true; |
3996
|
|
|
for ( i in key ) { |
3997
|
|
|
access( elems, fn, i, key[ i ], true, emptyGet, raw ); |
3998
|
|
|
} |
3999
|
|
|
|
4000
|
|
|
// Sets one value |
4001
|
|
|
} else if ( value !== undefined ) { |
4002
|
|
|
chainable = true; |
4003
|
|
|
|
4004
|
|
|
if ( !isFunction( value ) ) { |
4005
|
|
|
raw = true; |
4006
|
|
|
} |
4007
|
|
|
|
4008
|
|
|
if ( bulk ) { |
4009
|
|
|
|
4010
|
|
|
// Bulk operations run against the entire set |
4011
|
|
|
if ( raw ) { |
4012
|
|
|
fn.call( elems, value ); |
4013
|
|
|
fn = null; |
4014
|
|
|
|
4015
|
|
|
// ...except when executing function values |
4016
|
|
|
} else { |
4017
|
|
|
bulk = fn; |
4018
|
|
|
fn = function( elem, key, value ) { |
4019
|
|
|
return bulk.call( jQuery( elem ), value ); |
4020
|
|
|
}; |
4021
|
|
|
} |
4022
|
|
|
} |
4023
|
|
|
|
4024
|
|
|
if ( fn ) { |
4025
|
|
|
for ( ; i < len; i++ ) { |
4026
|
|
|
fn( |
4027
|
|
|
elems[ i ], key, raw ? |
4028
|
|
|
value : |
4029
|
|
|
value.call( elems[ i ], i, fn( elems[ i ], key ) ) |
4030
|
|
|
); |
4031
|
|
|
} |
4032
|
|
|
} |
4033
|
|
|
} |
4034
|
|
|
|
4035
|
|
|
if ( chainable ) { |
4036
|
|
|
return elems; |
4037
|
|
|
} |
4038
|
|
|
|
4039
|
|
|
// Gets |
4040
|
|
|
if ( bulk ) { |
4041
|
|
|
return fn.call( elems ); |
4042
|
|
|
} |
4043
|
|
|
|
4044
|
|
|
return len ? fn( elems[ 0 ], key ) : emptyGet; |
4045
|
|
|
}; |
4046
|
|
|
|
4047
|
|
|
|
4048
|
|
|
// Matches dashed string for camelizing |
4049
|
|
|
var rmsPrefix = /^-ms-/, |
4050
|
|
|
rdashAlpha = /-([a-z])/g; |
4051
|
|
|
|
4052
|
|
|
// Used by camelCase as callback to replace() |
4053
|
|
|
function fcamelCase( all, letter ) { |
4054
|
|
|
return letter.toUpperCase(); |
4055
|
|
|
} |
4056
|
|
|
|
4057
|
|
|
// Convert dashed to camelCase; used by the css and data modules |
4058
|
|
|
// Support: IE <=9 - 11, Edge 12 - 15 |
4059
|
|
|
// Microsoft forgot to hump their vendor prefix (#9572) |
4060
|
|
|
function camelCase( string ) { |
4061
|
|
|
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
4062
|
|
|
} |
4063
|
|
|
var acceptData = function( owner ) { |
4064
|
|
|
|
4065
|
|
|
// Accepts only: |
4066
|
|
|
// - Node |
4067
|
|
|
// - Node.ELEMENT_NODE |
4068
|
|
|
// - Node.DOCUMENT_NODE |
4069
|
|
|
// - Object |
4070
|
|
|
// - Any |
4071
|
|
|
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); |
4072
|
|
|
}; |
4073
|
|
|
|
4074
|
|
|
|
4075
|
|
|
|
4076
|
|
|
|
4077
|
|
|
function Data() { |
4078
|
|
|
this.expando = jQuery.expando + Data.uid++; |
4079
|
|
|
} |
4080
|
|
|
|
4081
|
|
|
Data.uid = 1; |
4082
|
|
|
|
4083
|
|
|
Data.prototype = { |
4084
|
|
|
|
4085
|
|
|
cache: function( owner ) { |
4086
|
|
|
|
4087
|
|
|
// Check if the owner object already has a cache |
4088
|
|
|
var value = owner[ this.expando ]; |
4089
|
|
|
|
4090
|
|
|
// If not, create one |
4091
|
|
|
if ( !value ) { |
4092
|
|
|
value = {}; |
4093
|
|
|
|
4094
|
|
|
// We can accept data for non-element nodes in modern browsers, |
4095
|
|
|
// but we should not, see #8335. |
4096
|
|
|
// Always return an empty object. |
4097
|
|
|
if ( acceptData( owner ) ) { |
4098
|
|
|
|
4099
|
|
|
// If it is a node unlikely to be stringify-ed or looped over |
4100
|
|
|
// use plain assignment |
4101
|
|
|
if ( owner.nodeType ) { |
4102
|
|
|
owner[ this.expando ] = value; |
4103
|
|
|
|
4104
|
|
|
// Otherwise secure it in a non-enumerable property |
4105
|
|
|
// configurable must be true to allow the property to be |
4106
|
|
|
// deleted when data is removed |
4107
|
|
|
} else { |
4108
|
|
|
Object.defineProperty( owner, this.expando, { |
4109
|
|
|
value: value, |
4110
|
|
|
configurable: true |
4111
|
|
|
} ); |
4112
|
|
|
} |
4113
|
|
|
} |
4114
|
|
|
} |
4115
|
|
|
|
4116
|
|
|
return value; |
4117
|
|
|
}, |
4118
|
|
|
set: function( owner, data, value ) { |
4119
|
|
|
var prop, |
4120
|
|
|
cache = this.cache( owner ); |
4121
|
|
|
|
4122
|
|
|
// Handle: [ owner, key, value ] args |
4123
|
|
|
// Always use camelCase key (gh-2257) |
4124
|
|
|
if ( typeof data === "string" ) { |
4125
|
|
|
cache[ camelCase( data ) ] = value; |
4126
|
|
|
|
4127
|
|
|
// Handle: [ owner, { properties } ] args |
4128
|
|
|
} else { |
4129
|
|
|
|
4130
|
|
|
// Copy the properties one-by-one to the cache object |
4131
|
|
|
for ( prop in data ) { |
4132
|
|
|
cache[ camelCase( prop ) ] = data[ prop ]; |
4133
|
|
|
} |
4134
|
|
|
} |
4135
|
|
|
return cache; |
4136
|
|
|
}, |
4137
|
|
|
get: function( owner, key ) { |
4138
|
|
|
return key === undefined ? |
4139
|
|
|
this.cache( owner ) : |
4140
|
|
|
|
4141
|
|
|
// Always use camelCase key (gh-2257) |
4142
|
|
|
owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; |
4143
|
|
|
}, |
4144
|
|
|
access: function( owner, key, value ) { |
4145
|
|
|
|
4146
|
|
|
// In cases where either: |
4147
|
|
|
// |
4148
|
|
|
// 1. No key was specified |
4149
|
|
|
// 2. A string key was specified, but no value provided |
4150
|
|
|
// |
4151
|
|
|
// Take the "read" path and allow the get method to determine |
4152
|
|
|
// which value to return, respectively either: |
4153
|
|
|
// |
4154
|
|
|
// 1. The entire cache object |
4155
|
|
|
// 2. The data stored at the key |
4156
|
|
|
// |
4157
|
|
|
if ( key === undefined || |
4158
|
|
|
( ( key && typeof key === "string" ) && value === undefined ) ) { |
4159
|
|
|
|
4160
|
|
|
return this.get( owner, key ); |
4161
|
|
|
} |
4162
|
|
|
|
4163
|
|
|
// When the key is not a string, or both a key and value |
4164
|
|
|
// are specified, set or extend (existing objects) with either: |
4165
|
|
|
// |
4166
|
|
|
// 1. An object of properties |
4167
|
|
|
// 2. A key and value |
4168
|
|
|
// |
4169
|
|
|
this.set( owner, key, value ); |
4170
|
|
|
|
4171
|
|
|
// Since the "set" path can have two possible entry points |
4172
|
|
|
// return the expected data based on which path was taken[*] |
4173
|
|
|
return value !== undefined ? value : key; |
4174
|
|
|
}, |
4175
|
|
|
remove: function( owner, key ) { |
4176
|
|
|
var i, |
4177
|
|
|
cache = owner[ this.expando ]; |
4178
|
|
|
|
4179
|
|
|
if ( cache === undefined ) { |
4180
|
|
|
return; |
4181
|
|
|
} |
4182
|
|
|
|
4183
|
|
|
if ( key !== undefined ) { |
4184
|
|
|
|
4185
|
|
|
// Support array or space separated string of keys |
4186
|
|
|
if ( Array.isArray( key ) ) { |
4187
|
|
|
|
4188
|
|
|
// If key is an array of keys... |
4189
|
|
|
// We always set camelCase keys, so remove that. |
4190
|
|
|
key = key.map( camelCase ); |
4191
|
|
|
} else { |
4192
|
|
|
key = camelCase( key ); |
4193
|
|
|
|
4194
|
|
|
// If a key with the spaces exists, use it. |
4195
|
|
|
// Otherwise, create an array by matching non-whitespace |
4196
|
|
|
key = key in cache ? |
4197
|
|
|
[ key ] : |
4198
|
|
|
( key.match( rnothtmlwhite ) || [] ); |
4199
|
|
|
} |
4200
|
|
|
|
4201
|
|
|
i = key.length; |
4202
|
|
|
|
4203
|
|
|
while ( i-- ) { |
4204
|
|
|
delete cache[ key[ i ] ]; |
4205
|
|
|
} |
4206
|
|
|
} |
4207
|
|
|
|
4208
|
|
|
// Remove the expando if there's no more data |
4209
|
|
|
if ( key === undefined || jQuery.isEmptyObject( cache ) ) { |
4210
|
|
|
|
4211
|
|
|
// Support: Chrome <=35 - 45 |
4212
|
|
|
// Webkit & Blink performance suffers when deleting properties |
4213
|
|
|
// from DOM nodes, so set to undefined instead |
4214
|
|
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) |
4215
|
|
|
if ( owner.nodeType ) { |
4216
|
|
|
owner[ this.expando ] = undefined; |
4217
|
|
|
} else { |
4218
|
|
|
delete owner[ this.expando ]; |
4219
|
|
|
} |
4220
|
|
|
} |
4221
|
|
|
}, |
4222
|
|
|
hasData: function( owner ) { |
4223
|
|
|
var cache = owner[ this.expando ]; |
4224
|
|
|
return cache !== undefined && !jQuery.isEmptyObject( cache ); |
4225
|
|
|
} |
4226
|
|
|
}; |
4227
|
|
|
var dataPriv = new Data(); |
4228
|
|
|
|
4229
|
|
|
var dataUser = new Data(); |
4230
|
|
|
|
4231
|
|
|
|
4232
|
|
|
|
4233
|
|
|
// Implementation Summary |
4234
|
|
|
// |
4235
|
|
|
// 1. Enforce API surface and semantic compatibility with 1.9.x branch |
4236
|
|
|
// 2. Improve the module's maintainability by reducing the storage |
4237
|
|
|
// paths to a single mechanism. |
4238
|
|
|
// 3. Use the same single mechanism to support "private" and "user" data. |
4239
|
|
|
// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) |
4240
|
|
|
// 5. Avoid exposing implementation details on user objects (eg. expando properties) |
4241
|
|
|
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 |
4242
|
|
|
|
4243
|
|
|
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, |
4244
|
|
|
rmultiDash = /[A-Z]/g; |
4245
|
|
|
|
4246
|
|
|
function getData( data ) { |
4247
|
|
|
if ( data === "true" ) { |
4248
|
|
|
return true; |
4249
|
|
|
} |
4250
|
|
|
|
4251
|
|
|
if ( data === "false" ) { |
4252
|
|
|
return false; |
4253
|
|
|
} |
4254
|
|
|
|
4255
|
|
|
if ( data === "null" ) { |
4256
|
|
|
return null; |
4257
|
|
|
} |
4258
|
|
|
|
4259
|
|
|
// Only convert to a number if it doesn't change the string |
4260
|
|
|
if ( data === +data + "" ) { |
4261
|
|
|
return +data; |
4262
|
|
|
} |
4263
|
|
|
|
4264
|
|
|
if ( rbrace.test( data ) ) { |
4265
|
|
|
return JSON.parse( data ); |
4266
|
|
|
} |
4267
|
|
|
|
4268
|
|
|
return data; |
4269
|
|
|
} |
4270
|
|
|
|
4271
|
|
|
function dataAttr( elem, key, data ) { |
4272
|
|
|
var name; |
4273
|
|
|
|
4274
|
|
|
// If nothing was found internally, try to fetch any |
4275
|
|
|
// data from the HTML5 data-* attribute |
4276
|
|
|
if ( data === undefined && elem.nodeType === 1 ) { |
4277
|
|
|
name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); |
4278
|
|
|
data = elem.getAttribute( name ); |
4279
|
|
|
|
4280
|
|
|
if ( typeof data === "string" ) { |
4281
|
|
|
try { |
4282
|
|
|
data = getData( data ); |
4283
|
|
|
} catch ( e ) {} |
4284
|
|
|
|
4285
|
|
|
// Make sure we set the data so it isn't changed later |
4286
|
|
|
dataUser.set( elem, key, data ); |
4287
|
|
|
} else { |
4288
|
|
|
data = undefined; |
4289
|
|
|
} |
4290
|
|
|
} |
4291
|
|
|
return data; |
4292
|
|
|
} |
4293
|
|
|
|
4294
|
|
|
jQuery.extend( { |
4295
|
|
|
hasData: function( elem ) { |
4296
|
|
|
return dataUser.hasData( elem ) || dataPriv.hasData( elem ); |
4297
|
|
|
}, |
4298
|
|
|
|
4299
|
|
|
data: function( elem, name, data ) { |
4300
|
|
|
return dataUser.access( elem, name, data ); |
4301
|
|
|
}, |
4302
|
|
|
|
4303
|
|
|
removeData: function( elem, name ) { |
4304
|
|
|
dataUser.remove( elem, name ); |
4305
|
|
|
}, |
4306
|
|
|
|
4307
|
|
|
// TODO: Now that all calls to _data and _removeData have been replaced |
4308
|
|
|
// with direct calls to dataPriv methods, these can be deprecated. |
4309
|
|
|
_data: function( elem, name, data ) { |
4310
|
|
|
return dataPriv.access( elem, name, data ); |
4311
|
|
|
}, |
4312
|
|
|
|
4313
|
|
|
_removeData: function( elem, name ) { |
4314
|
|
|
dataPriv.remove( elem, name ); |
4315
|
|
|
} |
4316
|
|
|
} ); |
4317
|
|
|
|
4318
|
|
|
jQuery.fn.extend( { |
4319
|
|
|
data: function( key, value ) { |
4320
|
|
|
var i, name, data, |
4321
|
|
|
elem = this[ 0 ], |
4322
|
|
|
attrs = elem && elem.attributes; |
4323
|
|
|
|
4324
|
|
|
// Gets all values |
4325
|
|
|
if ( key === undefined ) { |
4326
|
|
|
if ( this.length ) { |
4327
|
|
|
data = dataUser.get( elem ); |
4328
|
|
|
|
4329
|
|
|
if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { |
4330
|
|
|
i = attrs.length; |
4331
|
|
|
while ( i-- ) { |
4332
|
|
|
|
4333
|
|
|
// Support: IE 11 only |
4334
|
|
|
// The attrs elements can be null (#14894) |
4335
|
|
|
if ( attrs[ i ] ) { |
4336
|
|
|
name = attrs[ i ].name; |
4337
|
|
|
if ( name.indexOf( "data-" ) === 0 ) { |
4338
|
|
|
name = camelCase( name.slice( 5 ) ); |
4339
|
|
|
dataAttr( elem, name, data[ name ] ); |
4340
|
|
|
} |
4341
|
|
|
} |
4342
|
|
|
} |
4343
|
|
|
dataPriv.set( elem, "hasDataAttrs", true ); |
4344
|
|
|
} |
4345
|
|
|
} |
4346
|
|
|
|
4347
|
|
|
return data; |
4348
|
|
|
} |
4349
|
|
|
|
4350
|
|
|
// Sets multiple values |
4351
|
|
|
if ( typeof key === "object" ) { |
4352
|
|
|
return this.each( function() { |
4353
|
|
|
dataUser.set( this, key ); |
4354
|
|
|
} ); |
4355
|
|
|
} |
4356
|
|
|
|
4357
|
|
|
return access( this, function( value ) { |
4358
|
|
|
var data; |
4359
|
|
|
|
4360
|
|
|
// The calling jQuery object (element matches) is not empty |
4361
|
|
|
// (and therefore has an element appears at this[ 0 ]) and the |
4362
|
|
|
// `value` parameter was not undefined. An empty jQuery object |
4363
|
|
|
// will result in `undefined` for elem = this[ 0 ] which will |
4364
|
|
|
// throw an exception if an attempt to read a data cache is made. |
4365
|
|
|
if ( elem && value === undefined ) { |
4366
|
|
|
|
4367
|
|
|
// Attempt to get data from the cache |
4368
|
|
|
// The key will always be camelCased in Data |
4369
|
|
|
data = dataUser.get( elem, key ); |
4370
|
|
|
if ( data !== undefined ) { |
4371
|
|
|
return data; |
4372
|
|
|
} |
4373
|
|
|
|
4374
|
|
|
// Attempt to "discover" the data in |
4375
|
|
|
// HTML5 custom data-* attrs |
4376
|
|
|
data = dataAttr( elem, key ); |
4377
|
|
|
if ( data !== undefined ) { |
4378
|
|
|
return data; |
4379
|
|
|
} |
4380
|
|
|
|
4381
|
|
|
// We tried really hard, but the data doesn't exist. |
4382
|
|
|
return; |
4383
|
|
|
} |
4384
|
|
|
|
4385
|
|
|
// Set the data... |
4386
|
|
|
this.each( function() { |
4387
|
|
|
|
4388
|
|
|
// We always store the camelCased key |
4389
|
|
|
dataUser.set( this, key, value ); |
4390
|
|
|
} ); |
4391
|
|
|
}, null, value, arguments.length > 1, null, true ); |
4392
|
|
|
}, |
4393
|
|
|
|
4394
|
|
|
removeData: function( key ) { |
4395
|
|
|
return this.each( function() { |
4396
|
|
|
dataUser.remove( this, key ); |
4397
|
|
|
} ); |
4398
|
|
|
} |
4399
|
|
|
} ); |
4400
|
|
|
|
4401
|
|
|
|
4402
|
|
|
jQuery.extend( { |
4403
|
|
|
queue: function( elem, type, data ) { |
4404
|
|
|
var queue; |
4405
|
|
|
|
4406
|
|
|
if ( elem ) { |
4407
|
|
|
type = ( type || "fx" ) + "queue"; |
4408
|
|
|
queue = dataPriv.get( elem, type ); |
4409
|
|
|
|
4410
|
|
|
// Speed up dequeue by getting out quickly if this is just a lookup |
4411
|
|
|
if ( data ) { |
4412
|
|
|
if ( !queue || Array.isArray( data ) ) { |
4413
|
|
|
queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); |
4414
|
|
|
} else { |
4415
|
|
|
queue.push( data ); |
4416
|
|
|
} |
4417
|
|
|
} |
4418
|
|
|
return queue || []; |
4419
|
|
|
} |
4420
|
|
|
}, |
4421
|
|
|
|
4422
|
|
|
dequeue: function( elem, type ) { |
4423
|
|
|
type = type || "fx"; |
4424
|
|
|
|
4425
|
|
|
var queue = jQuery.queue( elem, type ), |
4426
|
|
|
startLength = queue.length, |
4427
|
|
|
fn = queue.shift(), |
4428
|
|
|
hooks = jQuery._queueHooks( elem, type ), |
4429
|
|
|
next = function() { |
4430
|
|
|
jQuery.dequeue( elem, type ); |
4431
|
|
|
}; |
4432
|
|
|
|
4433
|
|
|
// If the fx queue is dequeued, always remove the progress sentinel |
4434
|
|
|
if ( fn === "inprogress" ) { |
4435
|
|
|
fn = queue.shift(); |
4436
|
|
|
startLength--; |
4437
|
|
|
} |
4438
|
|
|
|
4439
|
|
|
if ( fn ) { |
4440
|
|
|
|
4441
|
|
|
// Add a progress sentinel to prevent the fx queue from being |
4442
|
|
|
// automatically dequeued |
4443
|
|
|
if ( type === "fx" ) { |
4444
|
|
|
queue.unshift( "inprogress" ); |
4445
|
|
|
} |
4446
|
|
|
|
4447
|
|
|
// Clear up the last queue stop function |
4448
|
|
|
delete hooks.stop; |
4449
|
|
|
fn.call( elem, next, hooks ); |
4450
|
|
|
} |
4451
|
|
|
|
4452
|
|
|
if ( !startLength && hooks ) { |
4453
|
|
|
hooks.empty.fire(); |
4454
|
|
|
} |
4455
|
|
|
}, |
4456
|
|
|
|
4457
|
|
|
// Not public - generate a queueHooks object, or return the current one |
4458
|
|
|
_queueHooks: function( elem, type ) { |
4459
|
|
|
var key = type + "queueHooks"; |
4460
|
|
|
return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { |
4461
|
|
|
empty: jQuery.Callbacks( "once memory" ).add( function() { |
4462
|
|
|
dataPriv.remove( elem, [ type + "queue", key ] ); |
4463
|
|
|
} ) |
4464
|
|
|
} ); |
4465
|
|
|
} |
4466
|
|
|
} ); |
4467
|
|
|
|
4468
|
|
|
jQuery.fn.extend( { |
4469
|
|
|
queue: function( type, data ) { |
4470
|
|
|
var setter = 2; |
4471
|
|
|
|
4472
|
|
|
if ( typeof type !== "string" ) { |
4473
|
|
|
data = type; |
4474
|
|
|
type = "fx"; |
4475
|
|
|
setter--; |
4476
|
|
|
} |
4477
|
|
|
|
4478
|
|
|
if ( arguments.length < setter ) { |
4479
|
|
|
return jQuery.queue( this[ 0 ], type ); |
4480
|
|
|
} |
4481
|
|
|
|
4482
|
|
|
return data === undefined ? |
4483
|
|
|
this : |
4484
|
|
|
this.each( function() { |
4485
|
|
|
var queue = jQuery.queue( this, type, data ); |
4486
|
|
|
|
4487
|
|
|
// Ensure a hooks for this queue |
4488
|
|
|
jQuery._queueHooks( this, type ); |
4489
|
|
|
|
4490
|
|
|
if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { |
4491
|
|
|
jQuery.dequeue( this, type ); |
4492
|
|
|
} |
4493
|
|
|
} ); |
4494
|
|
|
}, |
4495
|
|
|
dequeue: function( type ) { |
4496
|
|
|
return this.each( function() { |
4497
|
|
|
jQuery.dequeue( this, type ); |
4498
|
|
|
} ); |
4499
|
|
|
}, |
4500
|
|
|
clearQueue: function( type ) { |
4501
|
|
|
return this.queue( type || "fx", [] ); |
4502
|
|
|
}, |
4503
|
|
|
|
4504
|
|
|
// Get a promise resolved when queues of a certain type |
4505
|
|
|
// are emptied (fx is the type by default) |
4506
|
|
|
promise: function( type, obj ) { |
4507
|
|
|
var tmp, |
4508
|
|
|
count = 1, |
4509
|
|
|
defer = jQuery.Deferred(), |
4510
|
|
|
elements = this, |
4511
|
|
|
i = this.length, |
4512
|
|
|
resolve = function() { |
4513
|
|
|
if ( !( --count ) ) { |
4514
|
|
|
defer.resolveWith( elements, [ elements ] ); |
4515
|
|
|
} |
4516
|
|
|
}; |
4517
|
|
|
|
4518
|
|
|
if ( typeof type !== "string" ) { |
4519
|
|
|
obj = type; |
4520
|
|
|
type = undefined; |
4521
|
|
|
} |
4522
|
|
|
type = type || "fx"; |
4523
|
|
|
|
4524
|
|
|
while ( i-- ) { |
4525
|
|
|
tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); |
4526
|
|
|
if ( tmp && tmp.empty ) { |
4527
|
|
|
count++; |
4528
|
|
|
tmp.empty.add( resolve ); |
4529
|
|
|
} |
4530
|
|
|
} |
4531
|
|
|
resolve(); |
4532
|
|
|
return defer.promise( obj ); |
4533
|
|
|
} |
4534
|
|
|
} ); |
4535
|
|
|
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; |
4536
|
|
|
|
4537
|
|
|
var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); |
4538
|
|
|
|
4539
|
|
|
|
4540
|
|
|
var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; |
4541
|
|
|
|
4542
|
|
|
var isHiddenWithinTree = function( elem, el ) { |
4543
|
|
|
|
4544
|
|
|
// isHiddenWithinTree might be called from jQuery#filter function; |
4545
|
|
|
// in that case, element will be second argument |
4546
|
|
|
elem = el || elem; |
4547
|
|
|
|
4548
|
|
|
// Inline style trumps all |
4549
|
|
|
return elem.style.display === "none" || |
4550
|
|
|
elem.style.display === "" && |
4551
|
|
|
|
4552
|
|
|
// Otherwise, check computed style |
4553
|
|
|
// Support: Firefox <=43 - 45 |
4554
|
|
|
// Disconnected elements can have computed display: none, so first confirm that elem is |
4555
|
|
|
// in the document. |
4556
|
|
|
jQuery.contains( elem.ownerDocument, elem ) && |
4557
|
|
|
|
4558
|
|
|
jQuery.css( elem, "display" ) === "none"; |
4559
|
|
|
}; |
4560
|
|
|
|
4561
|
|
|
var swap = function( elem, options, callback, args ) { |
4562
|
|
|
var ret, name, |
4563
|
|
|
old = {}; |
4564
|
|
|
|
4565
|
|
|
// Remember the old values, and insert the new ones |
4566
|
|
|
for ( name in options ) { |
4567
|
|
|
old[ name ] = elem.style[ name ]; |
4568
|
|
|
elem.style[ name ] = options[ name ]; |
4569
|
|
|
} |
4570
|
|
|
|
4571
|
|
|
ret = callback.apply( elem, args || [] ); |
4572
|
|
|
|
4573
|
|
|
// Revert the old values |
4574
|
|
|
for ( name in options ) { |
4575
|
|
|
elem.style[ name ] = old[ name ]; |
4576
|
|
|
} |
4577
|
|
|
|
4578
|
|
|
return ret; |
4579
|
|
|
}; |
4580
|
|
|
|
4581
|
|
|
|
4582
|
|
|
|
4583
|
|
|
|
4584
|
|
|
function adjustCSS( elem, prop, valueParts, tween ) { |
4585
|
|
|
var adjusted, scale, |
4586
|
|
|
maxIterations = 20, |
4587
|
|
|
currentValue = tween ? |
4588
|
|
|
function() { |
4589
|
|
|
return tween.cur(); |
4590
|
|
|
} : |
4591
|
|
|
function() { |
4592
|
|
|
return jQuery.css( elem, prop, "" ); |
4593
|
|
|
}, |
4594
|
|
|
initial = currentValue(), |
4595
|
|
|
unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), |
4596
|
|
|
|
4597
|
|
|
// Starting value computation is required for potential unit mismatches |
4598
|
|
|
initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && |
4599
|
|
|
rcssNum.exec( jQuery.css( elem, prop ) ); |
4600
|
|
|
|
4601
|
|
|
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { |
4602
|
|
|
|
4603
|
|
|
// Support: Firefox <=54 |
4604
|
|
|
// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) |
4605
|
|
|
initial = initial / 2; |
4606
|
|
|
|
4607
|
|
|
// Trust units reported by jQuery.css |
4608
|
|
|
unit = unit || initialInUnit[ 3 ]; |
4609
|
|
|
|
4610
|
|
|
// Iteratively approximate from a nonzero starting point |
4611
|
|
|
initialInUnit = +initial || 1; |
4612
|
|
|
|
4613
|
|
|
while ( maxIterations-- ) { |
4614
|
|
|
|
4615
|
|
|
// Evaluate and update our best guess (doubling guesses that zero out). |
4616
|
|
|
// Finish if the scale equals or crosses 1 (making the old*new product non-positive). |
4617
|
|
|
jQuery.style( elem, prop, initialInUnit + unit ); |
4618
|
|
|
if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { |
4619
|
|
|
maxIterations = 0; |
4620
|
|
|
} |
4621
|
|
|
initialInUnit = initialInUnit / scale; |
4622
|
|
|
|
4623
|
|
|
} |
4624
|
|
|
|
4625
|
|
|
initialInUnit = initialInUnit * 2; |
4626
|
|
|
jQuery.style( elem, prop, initialInUnit + unit ); |
4627
|
|
|
|
4628
|
|
|
// Make sure we update the tween properties later on |
4629
|
|
|
valueParts = valueParts || []; |
4630
|
|
|
} |
4631
|
|
|
|
4632
|
|
|
if ( valueParts ) { |
4633
|
|
|
initialInUnit = +initialInUnit || +initial || 0; |
4634
|
|
|
|
4635
|
|
|
// Apply relative offset (+=/-=) if specified |
4636
|
|
|
adjusted = valueParts[ 1 ] ? |
4637
|
|
|
initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : |
4638
|
|
|
+valueParts[ 2 ]; |
4639
|
|
|
if ( tween ) { |
4640
|
|
|
tween.unit = unit; |
4641
|
|
|
tween.start = initialInUnit; |
4642
|
|
|
tween.end = adjusted; |
4643
|
|
|
} |
4644
|
|
|
} |
4645
|
|
|
return adjusted; |
4646
|
|
|
} |
4647
|
|
|
|
4648
|
|
|
|
4649
|
|
|
var defaultDisplayMap = {}; |
4650
|
|
|
|
4651
|
|
|
function getDefaultDisplay( elem ) { |
4652
|
|
|
var temp, |
4653
|
|
|
doc = elem.ownerDocument, |
4654
|
|
|
nodeName = elem.nodeName, |
4655
|
|
|
display = defaultDisplayMap[ nodeName ]; |
4656
|
|
|
|
4657
|
|
|
if ( display ) { |
4658
|
|
|
return display; |
4659
|
|
|
} |
4660
|
|
|
|
4661
|
|
|
temp = doc.body.appendChild( doc.createElement( nodeName ) ); |
4662
|
|
|
display = jQuery.css( temp, "display" ); |
4663
|
|
|
|
4664
|
|
|
temp.parentNode.removeChild( temp ); |
4665
|
|
|
|
4666
|
|
|
if ( display === "none" ) { |
4667
|
|
|
display = "block"; |
4668
|
|
|
} |
4669
|
|
|
defaultDisplayMap[ nodeName ] = display; |
4670
|
|
|
|
4671
|
|
|
return display; |
4672
|
|
|
} |
4673
|
|
|
|
4674
|
|
|
function showHide( elements, show ) { |
4675
|
|
|
var display, elem, |
4676
|
|
|
values = [], |
4677
|
|
|
index = 0, |
4678
|
|
|
length = elements.length; |
4679
|
|
|
|
4680
|
|
|
// Determine new display value for elements that need to change |
4681
|
|
|
for ( ; index < length; index++ ) { |
4682
|
|
|
elem = elements[ index ]; |
4683
|
|
|
if ( !elem.style ) { |
4684
|
|
|
continue; |
4685
|
|
|
} |
4686
|
|
|
|
4687
|
|
|
display = elem.style.display; |
4688
|
|
|
if ( show ) { |
4689
|
|
|
|
4690
|
|
|
// Since we force visibility upon cascade-hidden elements, an immediate (and slow) |
4691
|
|
|
// check is required in this first loop unless we have a nonempty display value (either |
4692
|
|
|
// inline or about-to-be-restored) |
4693
|
|
|
if ( display === "none" ) { |
4694
|
|
|
values[ index ] = dataPriv.get( elem, "display" ) || null; |
4695
|
|
|
if ( !values[ index ] ) { |
4696
|
|
|
elem.style.display = ""; |
4697
|
|
|
} |
4698
|
|
|
} |
4699
|
|
|
if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { |
4700
|
|
|
values[ index ] = getDefaultDisplay( elem ); |
4701
|
|
|
} |
4702
|
|
|
} else { |
4703
|
|
|
if ( display !== "none" ) { |
4704
|
|
|
values[ index ] = "none"; |
4705
|
|
|
|
4706
|
|
|
// Remember what we're overwriting |
4707
|
|
|
dataPriv.set( elem, "display", display ); |
4708
|
|
|
} |
4709
|
|
|
} |
4710
|
|
|
} |
4711
|
|
|
|
4712
|
|
|
// Set the display of the elements in a second loop to avoid constant reflow |
4713
|
|
|
for ( index = 0; index < length; index++ ) { |
4714
|
|
|
if ( values[ index ] != null ) { |
4715
|
|
|
elements[ index ].style.display = values[ index ]; |
4716
|
|
|
} |
4717
|
|
|
} |
4718
|
|
|
|
4719
|
|
|
return elements; |
4720
|
|
|
} |
4721
|
|
|
|
4722
|
|
|
jQuery.fn.extend( { |
4723
|
|
|
show: function() { |
4724
|
|
|
return showHide( this, true ); |
4725
|
|
|
}, |
4726
|
|
|
hide: function() { |
4727
|
|
|
return showHide( this ); |
4728
|
|
|
}, |
4729
|
|
|
toggle: function( state ) { |
4730
|
|
|
if ( typeof state === "boolean" ) { |
4731
|
|
|
return state ? this.show() : this.hide(); |
4732
|
|
|
} |
4733
|
|
|
|
4734
|
|
|
return this.each( function() { |
4735
|
|
|
if ( isHiddenWithinTree( this ) ) { |
4736
|
|
|
jQuery( this ).show(); |
4737
|
|
|
} else { |
4738
|
|
|
jQuery( this ).hide(); |
4739
|
|
|
} |
4740
|
|
|
} ); |
4741
|
|
|
} |
4742
|
|
|
} ); |
4743
|
|
|
var rcheckableType = ( /^(?:checkbox|radio)$/i ); |
4744
|
|
|
|
4745
|
|
|
var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); |
4746
|
|
|
|
4747
|
|
|
var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); |
4748
|
|
|
|
4749
|
|
|
|
4750
|
|
|
|
4751
|
|
|
// We have to close these tags to support XHTML (#13200) |
4752
|
|
|
var wrapMap = { |
4753
|
|
|
|
4754
|
|
|
// Support: IE <=9 only |
4755
|
|
|
option: [ 1, "<select multiple='multiple'>", "</select>" ], |
4756
|
|
|
|
4757
|
|
|
// XHTML parsers do not magically insert elements in the |
4758
|
|
|
// same way that tag soup parsers do. So we cannot shorten |
4759
|
|
|
// this by omitting <tbody> or other required elements. |
4760
|
|
|
thead: [ 1, "<table>", "</table>" ], |
4761
|
|
|
col: [ 2, "<table><colgroup>", "</colgroup></table>" ], |
4762
|
|
|
tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
4763
|
|
|
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], |
4764
|
|
|
|
4765
|
|
|
_default: [ 0, "", "" ] |
4766
|
|
|
}; |
4767
|
|
|
|
4768
|
|
|
// Support: IE <=9 only |
4769
|
|
|
wrapMap.optgroup = wrapMap.option; |
4770
|
|
|
|
4771
|
|
|
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; |
4772
|
|
|
wrapMap.th = wrapMap.td; |
4773
|
|
|
|
4774
|
|
|
|
4775
|
|
|
function getAll( context, tag ) { |
4776
|
|
|
|
4777
|
|
|
// Support: IE <=9 - 11 only |
4778
|
|
|
// Use typeof to avoid zero-argument method invocation on host objects (#15151) |
4779
|
|
|
var ret; |
4780
|
|
|
|
4781
|
|
|
if ( typeof context.getElementsByTagName !== "undefined" ) { |
4782
|
|
|
ret = context.getElementsByTagName( tag || "*" ); |
4783
|
|
|
|
4784
|
|
|
} else if ( typeof context.querySelectorAll !== "undefined" ) { |
4785
|
|
|
ret = context.querySelectorAll( tag || "*" ); |
4786
|
|
|
|
4787
|
|
|
} else { |
4788
|
|
|
ret = []; |
4789
|
|
|
} |
4790
|
|
|
|
4791
|
|
|
if ( tag === undefined || tag && nodeName( context, tag ) ) { |
4792
|
|
|
return jQuery.merge( [ context ], ret ); |
4793
|
|
|
} |
4794
|
|
|
|
4795
|
|
|
return ret; |
4796
|
|
|
} |
4797
|
|
|
|
4798
|
|
|
|
4799
|
|
|
// Mark scripts as having already been evaluated |
4800
|
|
|
function setGlobalEval( elems, refElements ) { |
4801
|
|
|
var i = 0, |
4802
|
|
|
l = elems.length; |
4803
|
|
|
|
4804
|
|
|
for ( ; i < l; i++ ) { |
4805
|
|
|
dataPriv.set( |
4806
|
|
|
elems[ i ], |
4807
|
|
|
"globalEval", |
4808
|
|
|
!refElements || dataPriv.get( refElements[ i ], "globalEval" ) |
4809
|
|
|
); |
4810
|
|
|
} |
4811
|
|
|
} |
4812
|
|
|
|
4813
|
|
|
|
4814
|
|
|
var rhtml = /<|&#?\w+;/; |
4815
|
|
|
|
4816
|
|
|
function buildFragment( elems, context, scripts, selection, ignored ) { |
4817
|
|
|
var elem, tmp, tag, wrap, contains, j, |
4818
|
|
|
fragment = context.createDocumentFragment(), |
4819
|
|
|
nodes = [], |
4820
|
|
|
i = 0, |
4821
|
|
|
l = elems.length; |
4822
|
|
|
|
4823
|
|
|
for ( ; i < l; i++ ) { |
4824
|
|
|
elem = elems[ i ]; |
4825
|
|
|
|
4826
|
|
|
if ( elem || elem === 0 ) { |
4827
|
|
|
|
4828
|
|
|
// Add nodes directly |
4829
|
|
|
if ( toType( elem ) === "object" ) { |
4830
|
|
|
|
4831
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only |
4832
|
|
|
// push.apply(_, arraylike) throws on ancient WebKit |
4833
|
|
|
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); |
4834
|
|
|
|
4835
|
|
|
// Convert non-html into a text node |
4836
|
|
|
} else if ( !rhtml.test( elem ) ) { |
4837
|
|
|
nodes.push( context.createTextNode( elem ) ); |
4838
|
|
|
|
4839
|
|
|
// Convert html into DOM nodes |
4840
|
|
|
} else { |
4841
|
|
|
tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); |
4842
|
|
|
|
4843
|
|
|
// Deserialize a standard representation |
4844
|
|
|
tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); |
4845
|
|
|
wrap = wrapMap[ tag ] || wrapMap._default; |
4846
|
|
|
tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; |
4847
|
|
|
|
4848
|
|
|
// Descend through wrappers to the right content |
4849
|
|
|
j = wrap[ 0 ]; |
4850
|
|
|
while ( j-- ) { |
4851
|
|
|
tmp = tmp.lastChild; |
4852
|
|
|
} |
4853
|
|
|
|
4854
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only |
4855
|
|
|
// push.apply(_, arraylike) throws on ancient WebKit |
4856
|
|
|
jQuery.merge( nodes, tmp.childNodes ); |
4857
|
|
|
|
4858
|
|
|
// Remember the top-level container |
4859
|
|
|
tmp = fragment.firstChild; |
4860
|
|
|
|
4861
|
|
|
// Ensure the created nodes are orphaned (#12392) |
4862
|
|
|
tmp.textContent = ""; |
4863
|
|
|
} |
4864
|
|
|
} |
4865
|
|
|
} |
4866
|
|
|
|
4867
|
|
|
// Remove wrapper from fragment |
4868
|
|
|
fragment.textContent = ""; |
4869
|
|
|
|
4870
|
|
|
i = 0; |
4871
|
|
|
while ( ( elem = nodes[ i++ ] ) ) { |
4872
|
|
|
|
4873
|
|
|
// Skip elements already in the context collection (trac-4087) |
4874
|
|
|
if ( selection && jQuery.inArray( elem, selection ) > -1 ) { |
4875
|
|
|
if ( ignored ) { |
4876
|
|
|
ignored.push( elem ); |
4877
|
|
|
} |
4878
|
|
|
continue; |
4879
|
|
|
} |
4880
|
|
|
|
4881
|
|
|
contains = jQuery.contains( elem.ownerDocument, elem ); |
4882
|
|
|
|
4883
|
|
|
// Append to fragment |
4884
|
|
|
tmp = getAll( fragment.appendChild( elem ), "script" ); |
4885
|
|
|
|
4886
|
|
|
// Preserve script evaluation history |
4887
|
|
|
if ( contains ) { |
4888
|
|
|
setGlobalEval( tmp ); |
4889
|
|
|
} |
4890
|
|
|
|
4891
|
|
|
// Capture executables |
4892
|
|
|
if ( scripts ) { |
4893
|
|
|
j = 0; |
4894
|
|
|
while ( ( elem = tmp[ j++ ] ) ) { |
4895
|
|
|
if ( rscriptType.test( elem.type || "" ) ) { |
4896
|
|
|
scripts.push( elem ); |
4897
|
|
|
} |
4898
|
|
|
} |
4899
|
|
|
} |
4900
|
|
|
} |
4901
|
|
|
|
4902
|
|
|
return fragment; |
4903
|
|
|
} |
4904
|
|
|
|
4905
|
|
|
|
4906
|
|
|
( function() { |
4907
|
|
|
var fragment = document.createDocumentFragment(), |
4908
|
|
|
div = fragment.appendChild( document.createElement( "div" ) ), |
4909
|
|
|
input = document.createElement( "input" ); |
4910
|
|
|
|
4911
|
|
|
// Support: Android 4.0 - 4.3 only |
4912
|
|
|
// Check state lost if the name is set (#11217) |
4913
|
|
|
// Support: Windows Web Apps (WWA) |
4914
|
|
|
// `name` and `type` must use .setAttribute for WWA (#14901) |
4915
|
|
|
input.setAttribute( "type", "radio" ); |
4916
|
|
|
input.setAttribute( "checked", "checked" ); |
4917
|
|
|
input.setAttribute( "name", "t" ); |
4918
|
|
|
|
4919
|
|
|
div.appendChild( input ); |
4920
|
|
|
|
4921
|
|
|
// Support: Android <=4.1 only |
4922
|
|
|
// Older WebKit doesn't clone checked state correctly in fragments |
4923
|
|
|
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; |
4924
|
|
|
|
4925
|
|
|
// Support: IE <=11 only |
4926
|
|
|
// Make sure textarea (and checkbox) defaultValue is properly cloned |
4927
|
|
|
div.innerHTML = "<textarea>x</textarea>"; |
4928
|
|
|
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; |
4929
|
|
|
} )(); |
4930
|
|
|
var documentElement = document.documentElement; |
4931
|
|
|
|
4932
|
|
|
|
4933
|
|
|
|
4934
|
|
|
var |
4935
|
|
|
rkeyEvent = /^key/, |
4936
|
|
|
rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, |
4937
|
|
|
rtypenamespace = /^([^.]*)(?:\.(.+)|)/; |
4938
|
|
|
|
4939
|
|
|
function returnTrue() { |
4940
|
|
|
return true; |
4941
|
|
|
} |
4942
|
|
|
|
4943
|
|
|
function returnFalse() { |
4944
|
|
|
return false; |
4945
|
|
|
} |
4946
|
|
|
|
4947
|
|
|
// Support: IE <=9 only |
4948
|
|
|
// See #13393 for more info |
4949
|
|
|
function safeActiveElement() { |
4950
|
|
|
try { |
4951
|
|
|
return document.activeElement; |
4952
|
|
|
} catch ( err ) { } |
4953
|
|
|
} |
4954
|
|
|
|
4955
|
|
|
function on( elem, types, selector, data, fn, one ) { |
4956
|
|
|
var origFn, type; |
4957
|
|
|
|
4958
|
|
|
// Types can be a map of types/handlers |
4959
|
|
|
if ( typeof types === "object" ) { |
4960
|
|
|
|
4961
|
|
|
// ( types-Object, selector, data ) |
4962
|
|
|
if ( typeof selector !== "string" ) { |
4963
|
|
|
|
4964
|
|
|
// ( types-Object, data ) |
4965
|
|
|
data = data || selector; |
4966
|
|
|
selector = undefined; |
4967
|
|
|
} |
4968
|
|
|
for ( type in types ) { |
4969
|
|
|
on( elem, type, selector, data, types[ type ], one ); |
4970
|
|
|
} |
4971
|
|
|
return elem; |
4972
|
|
|
} |
4973
|
|
|
|
4974
|
|
|
if ( data == null && fn == null ) { |
4975
|
|
|
|
4976
|
|
|
// ( types, fn ) |
4977
|
|
|
fn = selector; |
4978
|
|
|
data = selector = undefined; |
4979
|
|
|
} else if ( fn == null ) { |
4980
|
|
|
if ( typeof selector === "string" ) { |
4981
|
|
|
|
4982
|
|
|
// ( types, selector, fn ) |
4983
|
|
|
fn = data; |
4984
|
|
|
data = undefined; |
4985
|
|
|
} else { |
4986
|
|
|
|
4987
|
|
|
// ( types, data, fn ) |
4988
|
|
|
fn = data; |
4989
|
|
|
data = selector; |
4990
|
|
|
selector = undefined; |
4991
|
|
|
} |
4992
|
|
|
} |
4993
|
|
|
if ( fn === false ) { |
4994
|
|
|
fn = returnFalse; |
4995
|
|
|
} else if ( !fn ) { |
4996
|
|
|
return elem; |
4997
|
|
|
} |
4998
|
|
|
|
4999
|
|
|
if ( one === 1 ) { |
5000
|
|
|
origFn = fn; |
5001
|
|
|
fn = function( event ) { |
5002
|
|
|
|
5003
|
|
|
// Can use an empty set, since event contains the info |
5004
|
|
|
jQuery().off( event ); |
5005
|
|
|
return origFn.apply( this, arguments ); |
5006
|
|
|
}; |
5007
|
|
|
|
5008
|
|
|
// Use same guid so caller can remove using origFn |
5009
|
|
|
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); |
5010
|
|
|
} |
5011
|
|
|
return elem.each( function() { |
5012
|
|
|
jQuery.event.add( this, types, fn, data, selector ); |
5013
|
|
|
} ); |
5014
|
|
|
} |
5015
|
|
|
|
5016
|
|
|
/* |
5017
|
|
|
* Helper functions for managing events -- not part of the public interface. |
5018
|
|
|
* Props to Dean Edwards' addEvent library for many of the ideas. |
5019
|
|
|
*/ |
5020
|
|
|
jQuery.event = { |
5021
|
|
|
|
5022
|
|
|
global: {}, |
5023
|
|
|
|
5024
|
|
|
add: function( elem, types, handler, data, selector ) { |
5025
|
|
|
|
5026
|
|
|
var handleObjIn, eventHandle, tmp, |
5027
|
|
|
events, t, handleObj, |
5028
|
|
|
special, handlers, type, namespaces, origType, |
5029
|
|
|
elemData = dataPriv.get( elem ); |
5030
|
|
|
|
5031
|
|
|
// Don't attach events to noData or text/comment nodes (but allow plain objects) |
5032
|
|
|
if ( !elemData ) { |
5033
|
|
|
return; |
5034
|
|
|
} |
5035
|
|
|
|
5036
|
|
|
// Caller can pass in an object of custom data in lieu of the handler |
5037
|
|
|
if ( handler.handler ) { |
5038
|
|
|
handleObjIn = handler; |
5039
|
|
|
handler = handleObjIn.handler; |
5040
|
|
|
selector = handleObjIn.selector; |
5041
|
|
|
} |
5042
|
|
|
|
5043
|
|
|
// Ensure that invalid selectors throw exceptions at attach time |
5044
|
|
|
// Evaluate against documentElement in case elem is a non-element node (e.g., document) |
5045
|
|
|
if ( selector ) { |
5046
|
|
|
jQuery.find.matchesSelector( documentElement, selector ); |
5047
|
|
|
} |
5048
|
|
|
|
5049
|
|
|
// Make sure that the handler has a unique ID, used to find/remove it later |
5050
|
|
|
if ( !handler.guid ) { |
5051
|
|
|
handler.guid = jQuery.guid++; |
5052
|
|
|
} |
5053
|
|
|
|
5054
|
|
|
// Init the element's event structure and main handler, if this is the first |
5055
|
|
|
if ( !( events = elemData.events ) ) { |
5056
|
|
|
events = elemData.events = {}; |
5057
|
|
|
} |
5058
|
|
|
if ( !( eventHandle = elemData.handle ) ) { |
5059
|
|
|
eventHandle = elemData.handle = function( e ) { |
5060
|
|
|
|
5061
|
|
|
// Discard the second event of a jQuery.event.trigger() and |
5062
|
|
|
// when an event is called after a page has unloaded |
5063
|
|
|
return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? |
5064
|
|
|
jQuery.event.dispatch.apply( elem, arguments ) : undefined; |
5065
|
|
|
}; |
5066
|
|
|
} |
5067
|
|
|
|
5068
|
|
|
// Handle multiple events separated by a space |
5069
|
|
|
types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; |
5070
|
|
|
t = types.length; |
5071
|
|
|
while ( t-- ) { |
5072
|
|
|
tmp = rtypenamespace.exec( types[ t ] ) || []; |
5073
|
|
|
type = origType = tmp[ 1 ]; |
5074
|
|
|
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); |
5075
|
|
|
|
5076
|
|
|
// There *must* be a type, no attaching namespace-only handlers |
5077
|
|
|
if ( !type ) { |
5078
|
|
|
continue; |
5079
|
|
|
} |
5080
|
|
|
|
5081
|
|
|
// If event changes its type, use the special event handlers for the changed type |
5082
|
|
|
special = jQuery.event.special[ type ] || {}; |
5083
|
|
|
|
5084
|
|
|
// If selector defined, determine special event api type, otherwise given type |
5085
|
|
|
type = ( selector ? special.delegateType : special.bindType ) || type; |
5086
|
|
|
|
5087
|
|
|
// Update special based on newly reset type |
5088
|
|
|
special = jQuery.event.special[ type ] || {}; |
5089
|
|
|
|
5090
|
|
|
// handleObj is passed to all event handlers |
5091
|
|
|
handleObj = jQuery.extend( { |
5092
|
|
|
type: type, |
5093
|
|
|
origType: origType, |
5094
|
|
|
data: data, |
5095
|
|
|
handler: handler, |
5096
|
|
|
guid: handler.guid, |
5097
|
|
|
selector: selector, |
5098
|
|
|
needsContext: selector && jQuery.expr.match.needsContext.test( selector ), |
5099
|
|
|
namespace: namespaces.join( "." ) |
5100
|
|
|
}, handleObjIn ); |
5101
|
|
|
|
5102
|
|
|
// Init the event handler queue if we're the first |
5103
|
|
|
if ( !( handlers = events[ type ] ) ) { |
5104
|
|
|
handlers = events[ type ] = []; |
5105
|
|
|
handlers.delegateCount = 0; |
5106
|
|
|
|
5107
|
|
|
// Only use addEventListener if the special events handler returns false |
5108
|
|
|
if ( !special.setup || |
5109
|
|
|
special.setup.call( elem, data, namespaces, eventHandle ) === false ) { |
5110
|
|
|
|
5111
|
|
|
if ( elem.addEventListener ) { |
5112
|
|
|
elem.addEventListener( type, eventHandle ); |
5113
|
|
|
} |
5114
|
|
|
} |
5115
|
|
|
} |
5116
|
|
|
|
5117
|
|
|
if ( special.add ) { |
5118
|
|
|
special.add.call( elem, handleObj ); |
5119
|
|
|
|
5120
|
|
|
if ( !handleObj.handler.guid ) { |
5121
|
|
|
handleObj.handler.guid = handler.guid; |
5122
|
|
|
} |
5123
|
|
|
} |
5124
|
|
|
|
5125
|
|
|
// Add to the element's handler list, delegates in front |
5126
|
|
|
if ( selector ) { |
5127
|
|
|
handlers.splice( handlers.delegateCount++, 0, handleObj ); |
5128
|
|
|
} else { |
5129
|
|
|
handlers.push( handleObj ); |
5130
|
|
|
} |
5131
|
|
|
|
5132
|
|
|
// Keep track of which events have ever been used, for event optimization |
5133
|
|
|
jQuery.event.global[ type ] = true; |
5134
|
|
|
} |
5135
|
|
|
|
5136
|
|
|
}, |
5137
|
|
|
|
5138
|
|
|
// Detach an event or set of events from an element |
5139
|
|
|
remove: function( elem, types, handler, selector, mappedTypes ) { |
5140
|
|
|
|
5141
|
|
|
var j, origCount, tmp, |
5142
|
|
|
events, t, handleObj, |
5143
|
|
|
special, handlers, type, namespaces, origType, |
5144
|
|
|
elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); |
5145
|
|
|
|
5146
|
|
|
if ( !elemData || !( events = elemData.events ) ) { |
5147
|
|
|
return; |
5148
|
|
|
} |
5149
|
|
|
|
5150
|
|
|
// Once for each type.namespace in types; type may be omitted |
5151
|
|
|
types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; |
5152
|
|
|
t = types.length; |
5153
|
|
|
while ( t-- ) { |
5154
|
|
|
tmp = rtypenamespace.exec( types[ t ] ) || []; |
5155
|
|
|
type = origType = tmp[ 1 ]; |
5156
|
|
|
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); |
5157
|
|
|
|
5158
|
|
|
// Unbind all events (on this namespace, if provided) for the element |
5159
|
|
|
if ( !type ) { |
5160
|
|
|
for ( type in events ) { |
5161
|
|
|
jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); |
5162
|
|
|
} |
5163
|
|
|
continue; |
5164
|
|
|
} |
5165
|
|
|
|
5166
|
|
|
special = jQuery.event.special[ type ] || {}; |
5167
|
|
|
type = ( selector ? special.delegateType : special.bindType ) || type; |
5168
|
|
|
handlers = events[ type ] || []; |
5169
|
|
|
tmp = tmp[ 2 ] && |
5170
|
|
|
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); |
5171
|
|
|
|
5172
|
|
|
// Remove matching events |
5173
|
|
|
origCount = j = handlers.length; |
5174
|
|
|
while ( j-- ) { |
5175
|
|
|
handleObj = handlers[ j ]; |
5176
|
|
|
|
5177
|
|
|
if ( ( mappedTypes || origType === handleObj.origType ) && |
5178
|
|
|
( !handler || handler.guid === handleObj.guid ) && |
5179
|
|
|
( !tmp || tmp.test( handleObj.namespace ) ) && |
5180
|
|
|
( !selector || selector === handleObj.selector || |
5181
|
|
|
selector === "**" && handleObj.selector ) ) { |
5182
|
|
|
handlers.splice( j, 1 ); |
5183
|
|
|
|
5184
|
|
|
if ( handleObj.selector ) { |
5185
|
|
|
handlers.delegateCount--; |
5186
|
|
|
} |
5187
|
|
|
if ( special.remove ) { |
5188
|
|
|
special.remove.call( elem, handleObj ); |
5189
|
|
|
} |
5190
|
|
|
} |
5191
|
|
|
} |
5192
|
|
|
|
5193
|
|
|
// Remove generic event handler if we removed something and no more handlers exist |
5194
|
|
|
// (avoids potential for endless recursion during removal of special event handlers) |
5195
|
|
|
if ( origCount && !handlers.length ) { |
5196
|
|
|
if ( !special.teardown || |
5197
|
|
|
special.teardown.call( elem, namespaces, elemData.handle ) === false ) { |
5198
|
|
|
|
5199
|
|
|
jQuery.removeEvent( elem, type, elemData.handle ); |
5200
|
|
|
} |
5201
|
|
|
|
5202
|
|
|
delete events[ type ]; |
5203
|
|
|
} |
5204
|
|
|
} |
5205
|
|
|
|
5206
|
|
|
// Remove data and the expando if it's no longer used |
5207
|
|
|
if ( jQuery.isEmptyObject( events ) ) { |
5208
|
|
|
dataPriv.remove( elem, "handle events" ); |
5209
|
|
|
} |
5210
|
|
|
}, |
5211
|
|
|
|
5212
|
|
|
dispatch: function( nativeEvent ) { |
5213
|
|
|
|
5214
|
|
|
// Make a writable jQuery.Event from the native event object |
5215
|
|
|
var event = jQuery.event.fix( nativeEvent ); |
5216
|
|
|
|
5217
|
|
|
var i, j, ret, matched, handleObj, handlerQueue, |
5218
|
|
|
args = new Array( arguments.length ), |
5219
|
|
|
handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], |
5220
|
|
|
special = jQuery.event.special[ event.type ] || {}; |
5221
|
|
|
|
5222
|
|
|
// Use the fix-ed jQuery.Event rather than the (read-only) native event |
5223
|
|
|
args[ 0 ] = event; |
5224
|
|
|
|
5225
|
|
|
for ( i = 1; i < arguments.length; i++ ) { |
5226
|
|
|
args[ i ] = arguments[ i ]; |
5227
|
|
|
} |
5228
|
|
|
|
5229
|
|
|
event.delegateTarget = this; |
5230
|
|
|
|
5231
|
|
|
// Call the preDispatch hook for the mapped type, and let it bail if desired |
5232
|
|
|
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { |
5233
|
|
|
return; |
5234
|
|
|
} |
5235
|
|
|
|
5236
|
|
|
// Determine handlers |
5237
|
|
|
handlerQueue = jQuery.event.handlers.call( this, event, handlers ); |
5238
|
|
|
|
5239
|
|
|
// Run delegates first; they may want to stop propagation beneath us |
5240
|
|
|
i = 0; |
5241
|
|
|
while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { |
5242
|
|
|
event.currentTarget = matched.elem; |
5243
|
|
|
|
5244
|
|
|
j = 0; |
5245
|
|
|
while ( ( handleObj = matched.handlers[ j++ ] ) && |
5246
|
|
|
!event.isImmediatePropagationStopped() ) { |
5247
|
|
|
|
5248
|
|
|
// Triggered event must either 1) have no namespace, or 2) have namespace(s) |
5249
|
|
|
// a subset or equal to those in the bound event (both can have no namespace). |
5250
|
|
|
if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { |
5251
|
|
|
|
5252
|
|
|
event.handleObj = handleObj; |
5253
|
|
|
event.data = handleObj.data; |
5254
|
|
|
|
5255
|
|
|
ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || |
5256
|
|
|
handleObj.handler ).apply( matched.elem, args ); |
5257
|
|
|
|
5258
|
|
|
if ( ret !== undefined ) { |
5259
|
|
|
if ( ( event.result = ret ) === false ) { |
5260
|
|
|
event.preventDefault(); |
5261
|
|
|
event.stopPropagation(); |
5262
|
|
|
} |
5263
|
|
|
} |
5264
|
|
|
} |
5265
|
|
|
} |
5266
|
|
|
} |
5267
|
|
|
|
5268
|
|
|
// Call the postDispatch hook for the mapped type |
5269
|
|
|
if ( special.postDispatch ) { |
5270
|
|
|
special.postDispatch.call( this, event ); |
5271
|
|
|
} |
5272
|
|
|
|
5273
|
|
|
return event.result; |
5274
|
|
|
}, |
5275
|
|
|
|
5276
|
|
|
handlers: function( event, handlers ) { |
5277
|
|
|
var i, handleObj, sel, matchedHandlers, matchedSelectors, |
5278
|
|
|
handlerQueue = [], |
5279
|
|
|
delegateCount = handlers.delegateCount, |
5280
|
|
|
cur = event.target; |
5281
|
|
|
|
5282
|
|
|
// Find delegate handlers |
5283
|
|
|
if ( delegateCount && |
5284
|
|
|
|
5285
|
|
|
// Support: IE <=9 |
5286
|
|
|
// Black-hole SVG <use> instance trees (trac-13180) |
5287
|
|
|
cur.nodeType && |
5288
|
|
|
|
5289
|
|
|
// Support: Firefox <=42 |
5290
|
|
|
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) |
5291
|
|
|
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click |
5292
|
|
|
// Support: IE 11 only |
5293
|
|
|
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) |
5294
|
|
|
!( event.type === "click" && event.button >= 1 ) ) { |
5295
|
|
|
|
5296
|
|
|
for ( ; cur !== this; cur = cur.parentNode || this ) { |
5297
|
|
|
|
5298
|
|
|
// Don't check non-elements (#13208) |
5299
|
|
|
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) |
5300
|
|
|
if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { |
5301
|
|
|
matchedHandlers = []; |
5302
|
|
|
matchedSelectors = {}; |
5303
|
|
|
for ( i = 0; i < delegateCount; i++ ) { |
5304
|
|
|
handleObj = handlers[ i ]; |
5305
|
|
|
|
5306
|
|
|
// Don't conflict with Object.prototype properties (#13203) |
5307
|
|
|
sel = handleObj.selector + " "; |
5308
|
|
|
|
5309
|
|
|
if ( matchedSelectors[ sel ] === undefined ) { |
5310
|
|
|
matchedSelectors[ sel ] = handleObj.needsContext ? |
5311
|
|
|
jQuery( sel, this ).index( cur ) > -1 : |
5312
|
|
|
jQuery.find( sel, this, null, [ cur ] ).length; |
5313
|
|
|
} |
5314
|
|
|
if ( matchedSelectors[ sel ] ) { |
5315
|
|
|
matchedHandlers.push( handleObj ); |
5316
|
|
|
} |
5317
|
|
|
} |
5318
|
|
|
if ( matchedHandlers.length ) { |
5319
|
|
|
handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); |
5320
|
|
|
} |
5321
|
|
|
} |
5322
|
|
|
} |
5323
|
|
|
} |
5324
|
|
|
|
5325
|
|
|
// Add the remaining (directly-bound) handlers |
5326
|
|
|
cur = this; |
5327
|
|
|
if ( delegateCount < handlers.length ) { |
5328
|
|
|
handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); |
5329
|
|
|
} |
5330
|
|
|
|
5331
|
|
|
return handlerQueue; |
5332
|
|
|
}, |
5333
|
|
|
|
5334
|
|
|
addProp: function( name, hook ) { |
5335
|
|
|
Object.defineProperty( jQuery.Event.prototype, name, { |
5336
|
|
|
enumerable: true, |
5337
|
|
|
configurable: true, |
5338
|
|
|
|
5339
|
|
|
get: isFunction( hook ) ? |
5340
|
|
|
function() { |
5341
|
|
|
if ( this.originalEvent ) { |
5342
|
|
|
return hook( this.originalEvent ); |
5343
|
|
|
} |
5344
|
|
|
} : |
5345
|
|
|
function() { |
5346
|
|
|
if ( this.originalEvent ) { |
5347
|
|
|
return this.originalEvent[ name ]; |
5348
|
|
|
} |
5349
|
|
|
}, |
5350
|
|
|
|
5351
|
|
|
set: function( value ) { |
5352
|
|
|
Object.defineProperty( this, name, { |
5353
|
|
|
enumerable: true, |
5354
|
|
|
configurable: true, |
5355
|
|
|
writable: true, |
5356
|
|
|
value: value |
5357
|
|
|
} ); |
5358
|
|
|
} |
5359
|
|
|
} ); |
5360
|
|
|
}, |
5361
|
|
|
|
5362
|
|
|
fix: function( originalEvent ) { |
5363
|
|
|
return originalEvent[ jQuery.expando ] ? |
5364
|
|
|
originalEvent : |
5365
|
|
|
new jQuery.Event( originalEvent ); |
5366
|
|
|
}, |
5367
|
|
|
|
5368
|
|
|
special: { |
5369
|
|
|
load: { |
5370
|
|
|
|
5371
|
|
|
// Prevent triggered image.load events from bubbling to window.load |
5372
|
|
|
noBubble: true |
5373
|
|
|
}, |
5374
|
|
|
focus: { |
5375
|
|
|
|
5376
|
|
|
// Fire native event if possible so blur/focus sequence is correct |
5377
|
|
|
trigger: function() { |
5378
|
|
|
if ( this !== safeActiveElement() && this.focus ) { |
5379
|
|
|
this.focus(); |
5380
|
|
|
return false; |
5381
|
|
|
} |
5382
|
|
|
}, |
5383
|
|
|
delegateType: "focusin" |
5384
|
|
|
}, |
5385
|
|
|
blur: { |
5386
|
|
|
trigger: function() { |
5387
|
|
|
if ( this === safeActiveElement() && this.blur ) { |
5388
|
|
|
this.blur(); |
5389
|
|
|
return false; |
5390
|
|
|
} |
5391
|
|
|
}, |
5392
|
|
|
delegateType: "focusout" |
5393
|
|
|
}, |
5394
|
|
|
click: { |
5395
|
|
|
|
5396
|
|
|
// For checkbox, fire native event so checked state will be right |
5397
|
|
|
trigger: function() { |
5398
|
|
|
if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { |
5399
|
|
|
this.click(); |
5400
|
|
|
return false; |
5401
|
|
|
} |
5402
|
|
|
}, |
5403
|
|
|
|
5404
|
|
|
// For cross-browser consistency, don't fire native .click() on links |
5405
|
|
|
_default: function( event ) { |
5406
|
|
|
return nodeName( event.target, "a" ); |
5407
|
|
|
} |
5408
|
|
|
}, |
5409
|
|
|
|
5410
|
|
|
beforeunload: { |
5411
|
|
|
postDispatch: function( event ) { |
5412
|
|
|
|
5413
|
|
|
// Support: Firefox 20+ |
5414
|
|
|
// Firefox doesn't alert if the returnValue field is not set. |
5415
|
|
|
if ( event.result !== undefined && event.originalEvent ) { |
5416
|
|
|
event.originalEvent.returnValue = event.result; |
5417
|
|
|
} |
5418
|
|
|
} |
5419
|
|
|
} |
5420
|
|
|
} |
5421
|
|
|
}; |
5422
|
|
|
|
5423
|
|
|
jQuery.removeEvent = function( elem, type, handle ) { |
5424
|
|
|
|
5425
|
|
|
// This "if" is needed for plain objects |
5426
|
|
|
if ( elem.removeEventListener ) { |
5427
|
|
|
elem.removeEventListener( type, handle ); |
5428
|
|
|
} |
5429
|
|
|
}; |
5430
|
|
|
|
5431
|
|
|
jQuery.Event = function( src, props ) { |
5432
|
|
|
|
5433
|
|
|
// Allow instantiation without the 'new' keyword |
5434
|
|
|
if ( !( this instanceof jQuery.Event ) ) { |
5435
|
|
|
return new jQuery.Event( src, props ); |
5436
|
|
|
} |
5437
|
|
|
|
5438
|
|
|
// Event object |
5439
|
|
|
if ( src && src.type ) { |
5440
|
|
|
this.originalEvent = src; |
5441
|
|
|
this.type = src.type; |
5442
|
|
|
|
5443
|
|
|
// Events bubbling up the document may have been marked as prevented |
5444
|
|
|
// by a handler lower down the tree; reflect the correct value. |
5445
|
|
|
this.isDefaultPrevented = src.defaultPrevented || |
5446
|
|
|
src.defaultPrevented === undefined && |
5447
|
|
|
|
5448
|
|
|
// Support: Android <=2.3 only |
5449
|
|
|
src.returnValue === false ? |
5450
|
|
|
returnTrue : |
5451
|
|
|
returnFalse; |
5452
|
|
|
|
5453
|
|
|
// Create target properties |
5454
|
|
|
// Support: Safari <=6 - 7 only |
5455
|
|
|
// Target should not be a text node (#504, #13143) |
5456
|
|
|
this.target = ( src.target && src.target.nodeType === 3 ) ? |
5457
|
|
|
src.target.parentNode : |
5458
|
|
|
src.target; |
5459
|
|
|
|
5460
|
|
|
this.currentTarget = src.currentTarget; |
5461
|
|
|
this.relatedTarget = src.relatedTarget; |
5462
|
|
|
|
5463
|
|
|
// Event type |
5464
|
|
|
} else { |
5465
|
|
|
this.type = src; |
5466
|
|
|
} |
5467
|
|
|
|
5468
|
|
|
// Put explicitly provided properties onto the event object |
5469
|
|
|
if ( props ) { |
5470
|
|
|
jQuery.extend( this, props ); |
5471
|
|
|
} |
5472
|
|
|
|
5473
|
|
|
// Create a timestamp if incoming event doesn't have one |
5474
|
|
|
this.timeStamp = src && src.timeStamp || Date.now(); |
5475
|
|
|
|
5476
|
|
|
// Mark it as fixed |
5477
|
|
|
this[ jQuery.expando ] = true; |
5478
|
|
|
}; |
5479
|
|
|
|
5480
|
|
|
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
5481
|
|
|
// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
5482
|
|
|
jQuery.Event.prototype = { |
5483
|
|
|
constructor: jQuery.Event, |
5484
|
|
|
isDefaultPrevented: returnFalse, |
5485
|
|
|
isPropagationStopped: returnFalse, |
5486
|
|
|
isImmediatePropagationStopped: returnFalse, |
5487
|
|
|
isSimulated: false, |
5488
|
|
|
|
5489
|
|
|
preventDefault: function() { |
5490
|
|
|
var e = this.originalEvent; |
5491
|
|
|
|
5492
|
|
|
this.isDefaultPrevented = returnTrue; |
5493
|
|
|
|
5494
|
|
|
if ( e && !this.isSimulated ) { |
5495
|
|
|
e.preventDefault(); |
5496
|
|
|
} |
5497
|
|
|
}, |
5498
|
|
|
stopPropagation: function() { |
5499
|
|
|
var e = this.originalEvent; |
5500
|
|
|
|
5501
|
|
|
this.isPropagationStopped = returnTrue; |
5502
|
|
|
|
5503
|
|
|
if ( e && !this.isSimulated ) { |
5504
|
|
|
e.stopPropagation(); |
5505
|
|
|
} |
5506
|
|
|
}, |
5507
|
|
|
stopImmediatePropagation: function() { |
5508
|
|
|
var e = this.originalEvent; |
5509
|
|
|
|
5510
|
|
|
this.isImmediatePropagationStopped = returnTrue; |
5511
|
|
|
|
5512
|
|
|
if ( e && !this.isSimulated ) { |
5513
|
|
|
e.stopImmediatePropagation(); |
5514
|
|
|
} |
5515
|
|
|
|
5516
|
|
|
this.stopPropagation(); |
5517
|
|
|
} |
5518
|
|
|
}; |
5519
|
|
|
|
5520
|
|
|
// Includes all common event props including KeyEvent and MouseEvent specific props |
5521
|
|
|
jQuery.each( { |
5522
|
|
|
altKey: true, |
5523
|
|
|
bubbles: true, |
5524
|
|
|
cancelable: true, |
5525
|
|
|
changedTouches: true, |
5526
|
|
|
ctrlKey: true, |
5527
|
|
|
detail: true, |
5528
|
|
|
eventPhase: true, |
5529
|
|
|
metaKey: true, |
5530
|
|
|
pageX: true, |
5531
|
|
|
pageY: true, |
5532
|
|
|
shiftKey: true, |
5533
|
|
|
view: true, |
5534
|
|
|
"char": true, |
5535
|
|
|
charCode: true, |
5536
|
|
|
key: true, |
5537
|
|
|
keyCode: true, |
5538
|
|
|
button: true, |
5539
|
|
|
buttons: true, |
5540
|
|
|
clientX: true, |
5541
|
|
|
clientY: true, |
5542
|
|
|
offsetX: true, |
5543
|
|
|
offsetY: true, |
5544
|
|
|
pointerId: true, |
5545
|
|
|
pointerType: true, |
5546
|
|
|
screenX: true, |
5547
|
|
|
screenY: true, |
5548
|
|
|
targetTouches: true, |
5549
|
|
|
toElement: true, |
5550
|
|
|
touches: true, |
5551
|
|
|
|
5552
|
|
|
which: function( event ) { |
5553
|
|
|
var button = event.button; |
5554
|
|
|
|
5555
|
|
|
// Add which for key events |
5556
|
|
|
if ( event.which == null && rkeyEvent.test( event.type ) ) { |
5557
|
|
|
return event.charCode != null ? event.charCode : event.keyCode; |
5558
|
|
|
} |
5559
|
|
|
|
5560
|
|
|
// Add which for click: 1 === left; 2 === middle; 3 === right |
5561
|
|
|
if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { |
5562
|
|
|
if ( button & 1 ) { |
5563
|
|
|
return 1; |
5564
|
|
|
} |
5565
|
|
|
|
5566
|
|
|
if ( button & 2 ) { |
5567
|
|
|
return 3; |
5568
|
|
|
} |
5569
|
|
|
|
5570
|
|
|
if ( button & 4 ) { |
5571
|
|
|
return 2; |
5572
|
|
|
} |
5573
|
|
|
|
5574
|
|
|
return 0; |
5575
|
|
|
} |
5576
|
|
|
|
5577
|
|
|
return event.which; |
5578
|
|
|
} |
5579
|
|
|
}, jQuery.event.addProp ); |
5580
|
|
|
|
5581
|
|
|
// Create mouseenter/leave events using mouseover/out and event-time checks |
5582
|
|
|
// so that event delegation works in jQuery. |
5583
|
|
|
// Do the same for pointerenter/pointerleave and pointerover/pointerout |
5584
|
|
|
// |
5585
|
|
|
// Support: Safari 7 only |
5586
|
|
|
// Safari sends mouseenter too often; see: |
5587
|
|
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 |
5588
|
|
|
// for the description of the bug (it existed in older Chrome versions as well). |
5589
|
|
|
jQuery.each( { |
5590
|
|
|
mouseenter: "mouseover", |
5591
|
|
|
mouseleave: "mouseout", |
5592
|
|
|
pointerenter: "pointerover", |
5593
|
|
|
pointerleave: "pointerout" |
5594
|
|
|
}, function( orig, fix ) { |
5595
|
|
|
jQuery.event.special[ orig ] = { |
5596
|
|
|
delegateType: fix, |
5597
|
|
|
bindType: fix, |
5598
|
|
|
|
5599
|
|
|
handle: function( event ) { |
5600
|
|
|
var ret, |
5601
|
|
|
target = this, |
5602
|
|
|
related = event.relatedTarget, |
5603
|
|
|
handleObj = event.handleObj; |
5604
|
|
|
|
5605
|
|
|
// For mouseenter/leave call the handler if related is outside the target. |
5606
|
|
|
// NB: No relatedTarget if the mouse left/entered the browser window |
5607
|
|
|
if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { |
5608
|
|
|
event.type = handleObj.origType; |
5609
|
|
|
ret = handleObj.handler.apply( this, arguments ); |
5610
|
|
|
event.type = fix; |
5611
|
|
|
} |
5612
|
|
|
return ret; |
5613
|
|
|
} |
5614
|
|
|
}; |
5615
|
|
|
} ); |
5616
|
|
|
|
5617
|
|
|
jQuery.fn.extend( { |
5618
|
|
|
|
5619
|
|
|
on: function( types, selector, data, fn ) { |
5620
|
|
|
return on( this, types, selector, data, fn ); |
5621
|
|
|
}, |
5622
|
|
|
one: function( types, selector, data, fn ) { |
5623
|
|
|
return on( this, types, selector, data, fn, 1 ); |
5624
|
|
|
}, |
5625
|
|
|
off: function( types, selector, fn ) { |
5626
|
|
|
var handleObj, type; |
5627
|
|
|
if ( types && types.preventDefault && types.handleObj ) { |
5628
|
|
|
|
5629
|
|
|
// ( event ) dispatched jQuery.Event |
5630
|
|
|
handleObj = types.handleObj; |
5631
|
|
|
jQuery( types.delegateTarget ).off( |
5632
|
|
|
handleObj.namespace ? |
5633
|
|
|
handleObj.origType + "." + handleObj.namespace : |
5634
|
|
|
handleObj.origType, |
5635
|
|
|
handleObj.selector, |
5636
|
|
|
handleObj.handler |
5637
|
|
|
); |
5638
|
|
|
return this; |
5639
|
|
|
} |
5640
|
|
|
if ( typeof types === "object" ) { |
5641
|
|
|
|
5642
|
|
|
// ( types-object [, selector] ) |
5643
|
|
|
for ( type in types ) { |
5644
|
|
|
this.off( type, selector, types[ type ] ); |
5645
|
|
|
} |
5646
|
|
|
return this; |
5647
|
|
|
} |
5648
|
|
|
if ( selector === false || typeof selector === "function" ) { |
5649
|
|
|
|
5650
|
|
|
// ( types [, fn] ) |
5651
|
|
|
fn = selector; |
5652
|
|
|
selector = undefined; |
5653
|
|
|
} |
5654
|
|
|
if ( fn === false ) { |
5655
|
|
|
fn = returnFalse; |
5656
|
|
|
} |
5657
|
|
|
return this.each( function() { |
5658
|
|
|
jQuery.event.remove( this, types, fn, selector ); |
5659
|
|
|
} ); |
5660
|
|
|
} |
5661
|
|
|
} ); |
5662
|
|
|
|
5663
|
|
|
|
5664
|
|
|
var |
5665
|
|
|
|
5666
|
|
|
/* eslint-disable max-len */ |
5667
|
|
|
|
5668
|
|
|
// See https://github.com/eslint/eslint/issues/3229 |
5669
|
|
|
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, |
5670
|
|
|
|
5671
|
|
|
/* eslint-enable */ |
5672
|
|
|
|
5673
|
|
|
// Support: IE <=10 - 11, Edge 12 - 13 only |
5674
|
|
|
// In IE/Edge using regex groups here causes severe slowdowns. |
5675
|
|
|
// See https://connect.microsoft.com/IE/feedback/details/1736512/ |
5676
|
|
|
rnoInnerhtml = /<script|<style|<link/i, |
5677
|
|
|
|
5678
|
|
|
// checked="checked" or checked |
5679
|
|
|
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
5680
|
|
|
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; |
5681
|
|
|
|
5682
|
|
|
// Prefer a tbody over its parent table for containing new rows |
5683
|
|
|
function manipulationTarget( elem, content ) { |
5684
|
|
|
if ( nodeName( elem, "table" ) && |
5685
|
|
|
nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { |
5686
|
|
|
|
5687
|
|
|
return jQuery( elem ).children( "tbody" )[ 0 ] || elem; |
5688
|
|
|
} |
5689
|
|
|
|
5690
|
|
|
return elem; |
5691
|
|
|
} |
5692
|
|
|
|
5693
|
|
|
// Replace/restore the type attribute of script elements for safe DOM manipulation |
5694
|
|
|
function disableScript( elem ) { |
5695
|
|
|
elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; |
5696
|
|
|
return elem; |
5697
|
|
|
} |
5698
|
|
|
function restoreScript( elem ) { |
5699
|
|
|
if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { |
5700
|
|
|
elem.type = elem.type.slice( 5 ); |
5701
|
|
|
} else { |
5702
|
|
|
elem.removeAttribute( "type" ); |
5703
|
|
|
} |
5704
|
|
|
|
5705
|
|
|
return elem; |
5706
|
|
|
} |
5707
|
|
|
|
5708
|
|
|
function cloneCopyEvent( src, dest ) { |
5709
|
|
|
var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; |
5710
|
|
|
|
5711
|
|
|
if ( dest.nodeType !== 1 ) { |
5712
|
|
|
return; |
5713
|
|
|
} |
5714
|
|
|
|
5715
|
|
|
// 1. Copy private data: events, handlers, etc. |
5716
|
|
|
if ( dataPriv.hasData( src ) ) { |
5717
|
|
|
pdataOld = dataPriv.access( src ); |
5718
|
|
|
pdataCur = dataPriv.set( dest, pdataOld ); |
5719
|
|
|
events = pdataOld.events; |
5720
|
|
|
|
5721
|
|
|
if ( events ) { |
5722
|
|
|
delete pdataCur.handle; |
5723
|
|
|
pdataCur.events = {}; |
5724
|
|
|
|
5725
|
|
|
for ( type in events ) { |
5726
|
|
|
for ( i = 0, l = events[ type ].length; i < l; i++ ) { |
5727
|
|
|
jQuery.event.add( dest, type, events[ type ][ i ] ); |
5728
|
|
|
} |
5729
|
|
|
} |
5730
|
|
|
} |
5731
|
|
|
} |
5732
|
|
|
|
5733
|
|
|
// 2. Copy user data |
5734
|
|
|
if ( dataUser.hasData( src ) ) { |
5735
|
|
|
udataOld = dataUser.access( src ); |
5736
|
|
|
udataCur = jQuery.extend( {}, udataOld ); |
5737
|
|
|
|
5738
|
|
|
dataUser.set( dest, udataCur ); |
5739
|
|
|
} |
5740
|
|
|
} |
5741
|
|
|
|
5742
|
|
|
// Fix IE bugs, see support tests |
5743
|
|
|
function fixInput( src, dest ) { |
5744
|
|
|
var nodeName = dest.nodeName.toLowerCase(); |
5745
|
|
|
|
5746
|
|
|
// Fails to persist the checked state of a cloned checkbox or radio button. |
5747
|
|
|
if ( nodeName === "input" && rcheckableType.test( src.type ) ) { |
5748
|
|
|
dest.checked = src.checked; |
5749
|
|
|
|
5750
|
|
|
// Fails to return the selected option to the default selected state when cloning options |
5751
|
|
|
} else if ( nodeName === "input" || nodeName === "textarea" ) { |
5752
|
|
|
dest.defaultValue = src.defaultValue; |
5753
|
|
|
} |
5754
|
|
|
} |
5755
|
|
|
|
5756
|
|
|
function domManip( collection, args, callback, ignored ) { |
5757
|
|
|
|
5758
|
|
|
// Flatten any nested arrays |
5759
|
|
|
args = concat.apply( [], args ); |
5760
|
|
|
|
5761
|
|
|
var fragment, first, scripts, hasScripts, node, doc, |
5762
|
|
|
i = 0, |
5763
|
|
|
l = collection.length, |
5764
|
|
|
iNoClone = l - 1, |
5765
|
|
|
value = args[ 0 ], |
5766
|
|
|
valueIsFunction = isFunction( value ); |
5767
|
|
|
|
5768
|
|
|
// We can't cloneNode fragments that contain checked, in WebKit |
5769
|
|
|
if ( valueIsFunction || |
5770
|
|
|
( l > 1 && typeof value === "string" && |
5771
|
|
|
!support.checkClone && rchecked.test( value ) ) ) { |
5772
|
|
|
return collection.each( function( index ) { |
5773
|
|
|
var self = collection.eq( index ); |
5774
|
|
|
if ( valueIsFunction ) { |
5775
|
|
|
args[ 0 ] = value.call( this, index, self.html() ); |
5776
|
|
|
} |
5777
|
|
|
domManip( self, args, callback, ignored ); |
5778
|
|
|
} ); |
5779
|
|
|
} |
5780
|
|
|
|
5781
|
|
|
if ( l ) { |
5782
|
|
|
fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); |
5783
|
|
|
first = fragment.firstChild; |
5784
|
|
|
|
5785
|
|
|
if ( fragment.childNodes.length === 1 ) { |
5786
|
|
|
fragment = first; |
5787
|
|
|
} |
5788
|
|
|
|
5789
|
|
|
// Require either new content or an interest in ignored elements to invoke the callback |
5790
|
|
|
if ( first || ignored ) { |
5791
|
|
|
scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
5792
|
|
|
hasScripts = scripts.length; |
5793
|
|
|
|
5794
|
|
|
// Use the original fragment for the last item |
5795
|
|
|
// instead of the first because it can end up |
5796
|
|
|
// being emptied incorrectly in certain situations (#8070). |
5797
|
|
|
for ( ; i < l; i++ ) { |
5798
|
|
|
node = fragment; |
5799
|
|
|
|
5800
|
|
|
if ( i !== iNoClone ) { |
5801
|
|
|
node = jQuery.clone( node, true, true ); |
5802
|
|
|
|
5803
|
|
|
// Keep references to cloned scripts for later restoration |
5804
|
|
|
if ( hasScripts ) { |
5805
|
|
|
|
5806
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only |
5807
|
|
|
// push.apply(_, arraylike) throws on ancient WebKit |
5808
|
|
|
jQuery.merge( scripts, getAll( node, "script" ) ); |
5809
|
|
|
} |
5810
|
|
|
} |
5811
|
|
|
|
5812
|
|
|
callback.call( collection[ i ], node, i ); |
5813
|
|
|
} |
5814
|
|
|
|
5815
|
|
|
if ( hasScripts ) { |
5816
|
|
|
doc = scripts[ scripts.length - 1 ].ownerDocument; |
5817
|
|
|
|
5818
|
|
|
// Reenable scripts |
5819
|
|
|
jQuery.map( scripts, restoreScript ); |
5820
|
|
|
|
5821
|
|
|
// Evaluate executable scripts on first document insertion |
5822
|
|
|
for ( i = 0; i < hasScripts; i++ ) { |
5823
|
|
|
node = scripts[ i ]; |
5824
|
|
|
if ( rscriptType.test( node.type || "" ) && |
5825
|
|
|
!dataPriv.access( node, "globalEval" ) && |
5826
|
|
|
jQuery.contains( doc, node ) ) { |
5827
|
|
|
|
5828
|
|
|
if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { |
5829
|
|
|
|
5830
|
|
|
// Optional AJAX dependency, but won't run scripts if not present |
5831
|
|
|
if ( jQuery._evalUrl ) { |
5832
|
|
|
jQuery._evalUrl( node.src ); |
5833
|
|
|
} |
5834
|
|
|
} else { |
5835
|
|
|
DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node ); |
5836
|
|
|
} |
5837
|
|
|
} |
5838
|
|
|
} |
5839
|
|
|
} |
5840
|
|
|
} |
5841
|
|
|
} |
5842
|
|
|
|
5843
|
|
|
return collection; |
5844
|
|
|
} |
5845
|
|
|
|
5846
|
|
|
function remove( elem, selector, keepData ) { |
5847
|
|
|
var node, |
5848
|
|
|
nodes = selector ? jQuery.filter( selector, elem ) : elem, |
5849
|
|
|
i = 0; |
5850
|
|
|
|
5851
|
|
|
for ( ; ( node = nodes[ i ] ) != null; i++ ) { |
5852
|
|
|
if ( !keepData && node.nodeType === 1 ) { |
5853
|
|
|
jQuery.cleanData( getAll( node ) ); |
5854
|
|
|
} |
5855
|
|
|
|
5856
|
|
|
if ( node.parentNode ) { |
5857
|
|
|
if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { |
5858
|
|
|
setGlobalEval( getAll( node, "script" ) ); |
5859
|
|
|
} |
5860
|
|
|
node.parentNode.removeChild( node ); |
5861
|
|
|
} |
5862
|
|
|
} |
5863
|
|
|
|
5864
|
|
|
return elem; |
5865
|
|
|
} |
5866
|
|
|
|
5867
|
|
|
jQuery.extend( { |
5868
|
|
|
htmlPrefilter: function( html ) { |
5869
|
|
|
return html.replace( rxhtmlTag, "<$1></$2>" ); |
5870
|
|
|
}, |
5871
|
|
|
|
5872
|
|
|
clone: function( elem, dataAndEvents, deepDataAndEvents ) { |
5873
|
|
|
var i, l, srcElements, destElements, |
5874
|
|
|
clone = elem.cloneNode( true ), |
5875
|
|
|
inPage = jQuery.contains( elem.ownerDocument, elem ); |
5876
|
|
|
|
5877
|
|
|
// Fix IE cloning issues |
5878
|
|
|
if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && |
5879
|
|
|
!jQuery.isXMLDoc( elem ) ) { |
5880
|
|
|
|
5881
|
|
|
// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 |
5882
|
|
|
destElements = getAll( clone ); |
5883
|
|
|
srcElements = getAll( elem ); |
5884
|
|
|
|
5885
|
|
|
for ( i = 0, l = srcElements.length; i < l; i++ ) { |
5886
|
|
|
fixInput( srcElements[ i ], destElements[ i ] ); |
5887
|
|
|
} |
5888
|
|
|
} |
5889
|
|
|
|
5890
|
|
|
// Copy the events from the original to the clone |
5891
|
|
|
if ( dataAndEvents ) { |
5892
|
|
|
if ( deepDataAndEvents ) { |
5893
|
|
|
srcElements = srcElements || getAll( elem ); |
5894
|
|
|
destElements = destElements || getAll( clone ); |
5895
|
|
|
|
5896
|
|
|
for ( i = 0, l = srcElements.length; i < l; i++ ) { |
5897
|
|
|
cloneCopyEvent( srcElements[ i ], destElements[ i ] ); |
5898
|
|
|
} |
5899
|
|
|
} else { |
5900
|
|
|
cloneCopyEvent( elem, clone ); |
5901
|
|
|
} |
5902
|
|
|
} |
5903
|
|
|
|
5904
|
|
|
// Preserve script evaluation history |
5905
|
|
|
destElements = getAll( clone, "script" ); |
5906
|
|
|
if ( destElements.length > 0 ) { |
5907
|
|
|
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); |
5908
|
|
|
} |
5909
|
|
|
|
5910
|
|
|
// Return the cloned set |
5911
|
|
|
return clone; |
5912
|
|
|
}, |
5913
|
|
|
|
5914
|
|
|
cleanData: function( elems ) { |
5915
|
|
|
var data, elem, type, |
5916
|
|
|
special = jQuery.event.special, |
5917
|
|
|
i = 0; |
5918
|
|
|
|
5919
|
|
|
for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { |
5920
|
|
|
if ( acceptData( elem ) ) { |
5921
|
|
|
if ( ( data = elem[ dataPriv.expando ] ) ) { |
5922
|
|
|
if ( data.events ) { |
5923
|
|
|
for ( type in data.events ) { |
5924
|
|
|
if ( special[ type ] ) { |
5925
|
|
|
jQuery.event.remove( elem, type ); |
5926
|
|
|
|
5927
|
|
|
// This is a shortcut to avoid jQuery.event.remove's overhead |
5928
|
|
|
} else { |
5929
|
|
|
jQuery.removeEvent( elem, type, data.handle ); |
5930
|
|
|
} |
5931
|
|
|
} |
5932
|
|
|
} |
5933
|
|
|
|
5934
|
|
|
// Support: Chrome <=35 - 45+ |
5935
|
|
|
// Assign undefined instead of using delete, see Data#remove |
5936
|
|
|
elem[ dataPriv.expando ] = undefined; |
5937
|
|
|
} |
5938
|
|
|
if ( elem[ dataUser.expando ] ) { |
5939
|
|
|
|
5940
|
|
|
// Support: Chrome <=35 - 45+ |
5941
|
|
|
// Assign undefined instead of using delete, see Data#remove |
5942
|
|
|
elem[ dataUser.expando ] = undefined; |
5943
|
|
|
} |
5944
|
|
|
} |
5945
|
|
|
} |
5946
|
|
|
} |
5947
|
|
|
} ); |
5948
|
|
|
|
5949
|
|
|
jQuery.fn.extend( { |
5950
|
|
|
detach: function( selector ) { |
5951
|
|
|
return remove( this, selector, true ); |
5952
|
|
|
}, |
5953
|
|
|
|
5954
|
|
|
remove: function( selector ) { |
5955
|
|
|
return remove( this, selector ); |
5956
|
|
|
}, |
5957
|
|
|
|
5958
|
|
|
text: function( value ) { |
5959
|
|
|
return access( this, function( value ) { |
5960
|
|
|
return value === undefined ? |
5961
|
|
|
jQuery.text( this ) : |
5962
|
|
|
this.empty().each( function() { |
5963
|
|
|
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
5964
|
|
|
this.textContent = value; |
5965
|
|
|
} |
5966
|
|
|
} ); |
5967
|
|
|
}, null, value, arguments.length ); |
5968
|
|
|
}, |
5969
|
|
|
|
5970
|
|
|
append: function() { |
5971
|
|
|
return domManip( this, arguments, function( elem ) { |
5972
|
|
|
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
5973
|
|
|
var target = manipulationTarget( this, elem ); |
5974
|
|
|
target.appendChild( elem ); |
5975
|
|
|
} |
5976
|
|
|
} ); |
5977
|
|
|
}, |
5978
|
|
|
|
5979
|
|
|
prepend: function() { |
5980
|
|
|
return domManip( this, arguments, function( elem ) { |
5981
|
|
|
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
5982
|
|
|
var target = manipulationTarget( this, elem ); |
5983
|
|
|
target.insertBefore( elem, target.firstChild ); |
5984
|
|
|
} |
5985
|
|
|
} ); |
5986
|
|
|
}, |
5987
|
|
|
|
5988
|
|
|
before: function() { |
5989
|
|
|
return domManip( this, arguments, function( elem ) { |
5990
|
|
|
if ( this.parentNode ) { |
5991
|
|
|
this.parentNode.insertBefore( elem, this ); |
5992
|
|
|
} |
5993
|
|
|
} ); |
5994
|
|
|
}, |
5995
|
|
|
|
5996
|
|
|
after: function() { |
5997
|
|
|
return domManip( this, arguments, function( elem ) { |
5998
|
|
|
if ( this.parentNode ) { |
5999
|
|
|
this.parentNode.insertBefore( elem, this.nextSibling ); |
6000
|
|
|
} |
6001
|
|
|
} ); |
6002
|
|
|
}, |
6003
|
|
|
|
6004
|
|
|
empty: function() { |
6005
|
|
|
var elem, |
6006
|
|
|
i = 0; |
6007
|
|
|
|
6008
|
|
|
for ( ; ( elem = this[ i ] ) != null; i++ ) { |
6009
|
|
|
if ( elem.nodeType === 1 ) { |
6010
|
|
|
|
6011
|
|
|
// Prevent memory leaks |
6012
|
|
|
jQuery.cleanData( getAll( elem, false ) ); |
6013
|
|
|
|
6014
|
|
|
// Remove any remaining nodes |
6015
|
|
|
elem.textContent = ""; |
6016
|
|
|
} |
6017
|
|
|
} |
6018
|
|
|
|
6019
|
|
|
return this; |
6020
|
|
|
}, |
6021
|
|
|
|
6022
|
|
|
clone: function( dataAndEvents, deepDataAndEvents ) { |
6023
|
|
|
dataAndEvents = dataAndEvents == null ? false : dataAndEvents; |
6024
|
|
|
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
6025
|
|
|
|
6026
|
|
|
return this.map( function() { |
6027
|
|
|
return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); |
6028
|
|
|
} ); |
6029
|
|
|
}, |
6030
|
|
|
|
6031
|
|
|
html: function( value ) { |
6032
|
|
|
return access( this, function( value ) { |
6033
|
|
|
var elem = this[ 0 ] || {}, |
6034
|
|
|
i = 0, |
6035
|
|
|
l = this.length; |
6036
|
|
|
|
6037
|
|
|
if ( value === undefined && elem.nodeType === 1 ) { |
6038
|
|
|
return elem.innerHTML; |
6039
|
|
|
} |
6040
|
|
|
|
6041
|
|
|
// See if we can take a shortcut and just use innerHTML |
6042
|
|
|
if ( typeof value === "string" && !rnoInnerhtml.test( value ) && |
6043
|
|
|
!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { |
6044
|
|
|
|
6045
|
|
|
value = jQuery.htmlPrefilter( value ); |
6046
|
|
|
|
6047
|
|
|
try { |
6048
|
|
|
for ( ; i < l; i++ ) { |
6049
|
|
|
elem = this[ i ] || {}; |
6050
|
|
|
|
6051
|
|
|
// Remove element nodes and prevent memory leaks |
6052
|
|
|
if ( elem.nodeType === 1 ) { |
6053
|
|
|
jQuery.cleanData( getAll( elem, false ) ); |
6054
|
|
|
elem.innerHTML = value; |
6055
|
|
|
} |
6056
|
|
|
} |
6057
|
|
|
|
6058
|
|
|
elem = 0; |
6059
|
|
|
|
6060
|
|
|
// If using innerHTML throws an exception, use the fallback method |
6061
|
|
|
} catch ( e ) {} |
6062
|
|
|
} |
6063
|
|
|
|
6064
|
|
|
if ( elem ) { |
6065
|
|
|
this.empty().append( value ); |
6066
|
|
|
} |
6067
|
|
|
}, null, value, arguments.length ); |
6068
|
|
|
}, |
6069
|
|
|
|
6070
|
|
|
replaceWith: function() { |
6071
|
|
|
var ignored = []; |
6072
|
|
|
|
6073
|
|
|
// Make the changes, replacing each non-ignored context element with the new content |
6074
|
|
|
return domManip( this, arguments, function( elem ) { |
6075
|
|
|
var parent = this.parentNode; |
6076
|
|
|
|
6077
|
|
|
if ( jQuery.inArray( this, ignored ) < 0 ) { |
6078
|
|
|
jQuery.cleanData( getAll( this ) ); |
6079
|
|
|
if ( parent ) { |
6080
|
|
|
parent.replaceChild( elem, this ); |
6081
|
|
|
} |
6082
|
|
|
} |
6083
|
|
|
|
6084
|
|
|
// Force callback invocation |
6085
|
|
|
}, ignored ); |
6086
|
|
|
} |
6087
|
|
|
} ); |
6088
|
|
|
|
6089
|
|
|
jQuery.each( { |
6090
|
|
|
appendTo: "append", |
6091
|
|
|
prependTo: "prepend", |
6092
|
|
|
insertBefore: "before", |
6093
|
|
|
insertAfter: "after", |
6094
|
|
|
replaceAll: "replaceWith" |
6095
|
|
|
}, function( name, original ) { |
6096
|
|
|
jQuery.fn[ name ] = function( selector ) { |
6097
|
|
|
var elems, |
6098
|
|
|
ret = [], |
6099
|
|
|
insert = jQuery( selector ), |
6100
|
|
|
last = insert.length - 1, |
6101
|
|
|
i = 0; |
6102
|
|
|
|
6103
|
|
|
for ( ; i <= last; i++ ) { |
6104
|
|
|
elems = i === last ? this : this.clone( true ); |
6105
|
|
|
jQuery( insert[ i ] )[ original ]( elems ); |
6106
|
|
|
|
6107
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only |
6108
|
|
|
// .get() because push.apply(_, arraylike) throws on ancient WebKit |
6109
|
|
|
push.apply( ret, elems.get() ); |
6110
|
|
|
} |
6111
|
|
|
|
6112
|
|
|
return this.pushStack( ret ); |
6113
|
|
|
}; |
6114
|
|
|
} ); |
6115
|
|
|
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); |
6116
|
|
|
|
6117
|
|
|
var getStyles = function( elem ) { |
6118
|
|
|
|
6119
|
|
|
// Support: IE <=11 only, Firefox <=30 (#15098, #14150) |
6120
|
|
|
// IE throws on elements created in popups |
6121
|
|
|
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle" |
6122
|
|
|
var view = elem.ownerDocument.defaultView; |
6123
|
|
|
|
6124
|
|
|
if ( !view || !view.opener ) { |
6125
|
|
|
view = window; |
6126
|
|
|
} |
6127
|
|
|
|
6128
|
|
|
return view.getComputedStyle( elem ); |
6129
|
|
|
}; |
6130
|
|
|
|
6131
|
|
|
var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); |
6132
|
|
|
|
6133
|
|
|
|
6134
|
|
|
|
6135
|
|
|
( function() { |
6136
|
|
|
|
6137
|
|
|
// Executing both pixelPosition & boxSizingReliable tests require only one layout |
6138
|
|
|
// so they're executed at the same time to save the second computation. |
6139
|
|
|
function computeStyleTests() { |
6140
|
|
|
|
6141
|
|
|
// This is a singleton, we need to execute it only once |
6142
|
|
|
if ( !div ) { |
6143
|
|
|
return; |
6144
|
|
|
} |
6145
|
|
|
|
6146
|
|
|
container.style.cssText = "position:absolute;left:-11111px;width:60px;" + |
6147
|
|
|
"margin-top:1px;padding:0;border:0"; |
6148
|
|
|
div.style.cssText = |
6149
|
|
|
"position:relative;display:block;box-sizing:border-box;overflow:scroll;" + |
6150
|
|
|
"margin:auto;border:1px;padding:1px;" + |
6151
|
|
|
"width:60%;top:1%"; |
6152
|
|
|
documentElement.appendChild( container ).appendChild( div ); |
6153
|
|
|
|
6154
|
|
|
var divStyle = window.getComputedStyle( div ); |
6155
|
|
|
pixelPositionVal = divStyle.top !== "1%"; |
6156
|
|
|
|
6157
|
|
|
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 |
6158
|
|
|
reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; |
6159
|
|
|
|
6160
|
|
|
// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 |
6161
|
|
|
// Some styles come back with percentage values, even though they shouldn't |
6162
|
|
|
div.style.right = "60%"; |
6163
|
|
|
pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; |
6164
|
|
|
|
6165
|
|
|
// Support: IE 9 - 11 only |
6166
|
|
|
// Detect misreporting of content dimensions for box-sizing:border-box elements |
6167
|
|
|
boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; |
6168
|
|
|
|
6169
|
|
|
// Support: IE 9 only |
6170
|
|
|
// Detect overflow:scroll screwiness (gh-3699) |
6171
|
|
|
div.style.position = "absolute"; |
6172
|
|
|
scrollboxSizeVal = div.offsetWidth === 36 || "absolute"; |
6173
|
|
|
|
6174
|
|
|
documentElement.removeChild( container ); |
6175
|
|
|
|
6176
|
|
|
// Nullify the div so it wouldn't be stored in the memory and |
6177
|
|
|
// it will also be a sign that checks already performed |
6178
|
|
|
div = null; |
6179
|
|
|
} |
6180
|
|
|
|
6181
|
|
|
function roundPixelMeasures( measure ) { |
6182
|
|
|
return Math.round( parseFloat( measure ) ); |
6183
|
|
|
} |
6184
|
|
|
|
6185
|
|
|
var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, |
6186
|
|
|
reliableMarginLeftVal, |
6187
|
|
|
container = document.createElement( "div" ), |
6188
|
|
|
div = document.createElement( "div" ); |
6189
|
|
|
|
6190
|
|
|
// Finish early in limited (non-browser) environments |
6191
|
|
|
if ( !div.style ) { |
6192
|
|
|
return; |
6193
|
|
|
} |
6194
|
|
|
|
6195
|
|
|
// Support: IE <=9 - 11 only |
6196
|
|
|
// Style of cloned element affects source element cloned (#8908) |
6197
|
|
|
div.style.backgroundClip = "content-box"; |
6198
|
|
|
div.cloneNode( true ).style.backgroundClip = ""; |
6199
|
|
|
support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
6200
|
|
|
|
6201
|
|
|
jQuery.extend( support, { |
6202
|
|
|
boxSizingReliable: function() { |
6203
|
|
|
computeStyleTests(); |
6204
|
|
|
return boxSizingReliableVal; |
6205
|
|
|
}, |
6206
|
|
|
pixelBoxStyles: function() { |
6207
|
|
|
computeStyleTests(); |
6208
|
|
|
return pixelBoxStylesVal; |
6209
|
|
|
}, |
6210
|
|
|
pixelPosition: function() { |
6211
|
|
|
computeStyleTests(); |
6212
|
|
|
return pixelPositionVal; |
6213
|
|
|
}, |
6214
|
|
|
reliableMarginLeft: function() { |
6215
|
|
|
computeStyleTests(); |
6216
|
|
|
return reliableMarginLeftVal; |
6217
|
|
|
}, |
6218
|
|
|
scrollboxSize: function() { |
6219
|
|
|
computeStyleTests(); |
6220
|
|
|
return scrollboxSizeVal; |
6221
|
|
|
} |
6222
|
|
|
} ); |
6223
|
|
|
} )(); |
6224
|
|
|
|
6225
|
|
|
|
6226
|
|
|
function curCSS( elem, name, computed ) { |
6227
|
|
|
var width, minWidth, maxWidth, ret, |
6228
|
|
|
|
6229
|
|
|
// Support: Firefox 51+ |
6230
|
|
|
// Retrieving style before computed somehow |
6231
|
|
|
// fixes an issue with getting wrong values |
6232
|
|
|
// on detached elements |
6233
|
|
|
style = elem.style; |
6234
|
|
|
|
6235
|
|
|
computed = computed || getStyles( elem ); |
6236
|
|
|
|
6237
|
|
|
// getPropertyValue is needed for: |
6238
|
|
|
// .css('filter') (IE 9 only, #12537) |
6239
|
|
|
// .css('--customProperty) (#3144) |
6240
|
|
|
if ( computed ) { |
6241
|
|
|
ret = computed.getPropertyValue( name ) || computed[ name ]; |
6242
|
|
|
|
6243
|
|
|
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { |
6244
|
|
|
ret = jQuery.style( elem, name ); |
6245
|
|
|
} |
6246
|
|
|
|
6247
|
|
|
// A tribute to the "awesome hack by Dean Edwards" |
6248
|
|
|
// Android Browser returns percentage for some values, |
6249
|
|
|
// but width seems to be reliably pixels. |
6250
|
|
|
// This is against the CSSOM draft spec: |
6251
|
|
|
// https://drafts.csswg.org/cssom/#resolved-values |
6252
|
|
|
if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { |
6253
|
|
|
|
6254
|
|
|
// Remember the original values |
6255
|
|
|
width = style.width; |
6256
|
|
|
minWidth = style.minWidth; |
6257
|
|
|
maxWidth = style.maxWidth; |
6258
|
|
|
|
6259
|
|
|
// Put in the new values to get a computed value out |
6260
|
|
|
style.minWidth = style.maxWidth = style.width = ret; |
6261
|
|
|
ret = computed.width; |
6262
|
|
|
|
6263
|
|
|
// Revert the changed values |
6264
|
|
|
style.width = width; |
6265
|
|
|
style.minWidth = minWidth; |
6266
|
|
|
style.maxWidth = maxWidth; |
6267
|
|
|
} |
6268
|
|
|
} |
6269
|
|
|
|
6270
|
|
|
return ret !== undefined ? |
6271
|
|
|
|
6272
|
|
|
// Support: IE <=9 - 11 only |
6273
|
|
|
// IE returns zIndex value as an integer. |
6274
|
|
|
ret + "" : |
6275
|
|
|
ret; |
6276
|
|
|
} |
6277
|
|
|
|
6278
|
|
|
|
6279
|
|
|
function addGetHookIf( conditionFn, hookFn ) { |
6280
|
|
|
|
6281
|
|
|
// Define the hook, we'll check on the first run if it's really needed. |
6282
|
|
|
return { |
6283
|
|
|
get: function() { |
6284
|
|
|
if ( conditionFn() ) { |
6285
|
|
|
|
6286
|
|
|
// Hook not needed (or it's not possible to use it due |
6287
|
|
|
// to missing dependency), remove it. |
6288
|
|
|
delete this.get; |
6289
|
|
|
return; |
6290
|
|
|
} |
6291
|
|
|
|
6292
|
|
|
// Hook needed; redefine it so that the support test is not executed again. |
6293
|
|
|
return ( this.get = hookFn ).apply( this, arguments ); |
6294
|
|
|
} |
6295
|
|
|
}; |
6296
|
|
|
} |
6297
|
|
|
|
6298
|
|
|
|
6299
|
|
|
var |
6300
|
|
|
|
6301
|
|
|
// Swappable if display is none or starts with table |
6302
|
|
|
// except "table", "table-cell", or "table-caption" |
6303
|
|
|
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
6304
|
|
|
rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
6305
|
|
|
rcustomProp = /^--/, |
6306
|
|
|
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
6307
|
|
|
cssNormalTransform = { |
6308
|
|
|
letterSpacing: "0", |
6309
|
|
|
fontWeight: "400" |
6310
|
|
|
}, |
6311
|
|
|
|
6312
|
|
|
cssPrefixes = [ "Webkit", "Moz", "ms" ], |
6313
|
|
|
emptyStyle = document.createElement( "div" ).style; |
6314
|
|
|
|
6315
|
|
|
// Return a css property mapped to a potentially vendor prefixed property |
6316
|
|
|
function vendorPropName( name ) { |
6317
|
|
|
|
6318
|
|
|
// Shortcut for names that are not vendor prefixed |
6319
|
|
|
if ( name in emptyStyle ) { |
6320
|
|
|
return name; |
6321
|
|
|
} |
6322
|
|
|
|
6323
|
|
|
// Check for vendor prefixed names |
6324
|
|
|
var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), |
6325
|
|
|
i = cssPrefixes.length; |
6326
|
|
|
|
6327
|
|
|
while ( i-- ) { |
6328
|
|
|
name = cssPrefixes[ i ] + capName; |
6329
|
|
|
if ( name in emptyStyle ) { |
6330
|
|
|
return name; |
6331
|
|
|
} |
6332
|
|
|
} |
6333
|
|
|
} |
6334
|
|
|
|
6335
|
|
|
// Return a property mapped along what jQuery.cssProps suggests or to |
6336
|
|
|
// a vendor prefixed property. |
6337
|
|
|
function finalPropName( name ) { |
6338
|
|
|
var ret = jQuery.cssProps[ name ]; |
6339
|
|
|
if ( !ret ) { |
6340
|
|
|
ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; |
6341
|
|
|
} |
6342
|
|
|
return ret; |
6343
|
|
|
} |
6344
|
|
|
|
6345
|
|
|
function setPositiveNumber( elem, value, subtract ) { |
6346
|
|
|
|
6347
|
|
|
// Any relative (+/-) values have already been |
6348
|
|
|
// normalized at this point |
6349
|
|
|
var matches = rcssNum.exec( value ); |
6350
|
|
|
return matches ? |
6351
|
|
|
|
6352
|
|
|
// Guard against undefined "subtract", e.g., when used as in cssHooks |
6353
|
|
|
Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : |
6354
|
|
|
value; |
6355
|
|
|
} |
6356
|
|
|
|
6357
|
|
|
function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { |
6358
|
|
|
var i = dimension === "width" ? 1 : 0, |
6359
|
|
|
extra = 0, |
6360
|
|
|
delta = 0; |
6361
|
|
|
|
6362
|
|
|
// Adjustment may not be necessary |
6363
|
|
|
if ( box === ( isBorderBox ? "border" : "content" ) ) { |
6364
|
|
|
return 0; |
6365
|
|
|
} |
6366
|
|
|
|
6367
|
|
|
for ( ; i < 4; i += 2 ) { |
6368
|
|
|
|
6369
|
|
|
// Both box models exclude margin |
6370
|
|
|
if ( box === "margin" ) { |
6371
|
|
|
delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); |
6372
|
|
|
} |
6373
|
|
|
|
6374
|
|
|
// If we get here with a content-box, we're seeking "padding" or "border" or "margin" |
6375
|
|
|
if ( !isBorderBox ) { |
6376
|
|
|
|
6377
|
|
|
// Add padding |
6378
|
|
|
delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
6379
|
|
|
|
6380
|
|
|
// For "border" or "margin", add border |
6381
|
|
|
if ( box !== "padding" ) { |
6382
|
|
|
delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
6383
|
|
|
|
6384
|
|
|
// But still keep track of it otherwise |
6385
|
|
|
} else { |
6386
|
|
|
extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
6387
|
|
|
} |
6388
|
|
|
|
6389
|
|
|
// If we get here with a border-box (content + padding + border), we're seeking "content" or |
6390
|
|
|
// "padding" or "margin" |
6391
|
|
|
} else { |
6392
|
|
|
|
6393
|
|
|
// For "content", subtract padding |
6394
|
|
|
if ( box === "content" ) { |
6395
|
|
|
delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
6396
|
|
|
} |
6397
|
|
|
|
6398
|
|
|
// For "content" or "padding", subtract border |
6399
|
|
|
if ( box !== "margin" ) { |
6400
|
|
|
delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
6401
|
|
|
} |
6402
|
|
|
} |
6403
|
|
|
} |
6404
|
|
|
|
6405
|
|
|
// Account for positive content-box scroll gutter when requested by providing computedVal |
6406
|
|
|
if ( !isBorderBox && computedVal >= 0 ) { |
6407
|
|
|
|
6408
|
|
|
// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border |
6409
|
|
|
// Assuming integer scroll gutter, subtract the rest and round down |
6410
|
|
|
delta += Math.max( 0, Math.ceil( |
6411
|
|
|
elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - |
6412
|
|
|
computedVal - |
6413
|
|
|
delta - |
6414
|
|
|
extra - |
6415
|
|
|
0.5 |
6416
|
|
|
) ); |
6417
|
|
|
} |
6418
|
|
|
|
6419
|
|
|
return delta; |
6420
|
|
|
} |
6421
|
|
|
|
6422
|
|
|
function getWidthOrHeight( elem, dimension, extra ) { |
6423
|
|
|
|
6424
|
|
|
// Start with computed style |
6425
|
|
|
var styles = getStyles( elem ), |
6426
|
|
|
val = curCSS( elem, dimension, styles ), |
6427
|
|
|
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", |
6428
|
|
|
valueIsBorderBox = isBorderBox; |
6429
|
|
|
|
6430
|
|
|
// Support: Firefox <=54 |
6431
|
|
|
// Return a confounding non-pixel value or feign ignorance, as appropriate. |
6432
|
|
|
if ( rnumnonpx.test( val ) ) { |
6433
|
|
|
if ( !extra ) { |
6434
|
|
|
return val; |
6435
|
|
|
} |
6436
|
|
|
val = "auto"; |
6437
|
|
|
} |
6438
|
|
|
|
6439
|
|
|
// Check for style in case a browser which returns unreliable values |
6440
|
|
|
// for getComputedStyle silently falls back to the reliable elem.style |
6441
|
|
|
valueIsBorderBox = valueIsBorderBox && |
6442
|
|
|
( support.boxSizingReliable() || val === elem.style[ dimension ] ); |
6443
|
|
|
|
6444
|
|
|
// Fall back to offsetWidth/offsetHeight when value is "auto" |
6445
|
|
|
// This happens for inline elements with no explicit setting (gh-3571) |
6446
|
|
|
// Support: Android <=4.1 - 4.3 only |
6447
|
|
|
// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) |
6448
|
|
|
if ( val === "auto" || |
6449
|
|
|
!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) { |
6450
|
|
|
|
6451
|
|
|
val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ]; |
6452
|
|
|
|
6453
|
|
|
// offsetWidth/offsetHeight provide border-box values |
6454
|
|
|
valueIsBorderBox = true; |
6455
|
|
|
} |
6456
|
|
|
|
6457
|
|
|
// Normalize "" and auto |
6458
|
|
|
val = parseFloat( val ) || 0; |
6459
|
|
|
|
6460
|
|
|
// Adjust for the element's box model |
6461
|
|
|
return ( val + |
6462
|
|
|
boxModelAdjustment( |
6463
|
|
|
elem, |
6464
|
|
|
dimension, |
6465
|
|
|
extra || ( isBorderBox ? "border" : "content" ), |
6466
|
|
|
valueIsBorderBox, |
6467
|
|
|
styles, |
6468
|
|
|
|
6469
|
|
|
// Provide the current computed size to request scroll gutter calculation (gh-3589) |
6470
|
|
|
val |
6471
|
|
|
) |
6472
|
|
|
) + "px"; |
6473
|
|
|
} |
6474
|
|
|
|
6475
|
|
|
jQuery.extend( { |
6476
|
|
|
|
6477
|
|
|
// Add in style property hooks for overriding the default |
6478
|
|
|
// behavior of getting and setting a style property |
6479
|
|
|
cssHooks: { |
6480
|
|
|
opacity: { |
6481
|
|
|
get: function( elem, computed ) { |
6482
|
|
|
if ( computed ) { |
6483
|
|
|
|
6484
|
|
|
// We should always get a number back from opacity |
6485
|
|
|
var ret = curCSS( elem, "opacity" ); |
6486
|
|
|
return ret === "" ? "1" : ret; |
6487
|
|
|
} |
6488
|
|
|
} |
6489
|
|
|
} |
6490
|
|
|
}, |
6491
|
|
|
|
6492
|
|
|
// Don't automatically add "px" to these possibly-unitless properties |
6493
|
|
|
cssNumber: { |
6494
|
|
|
"animationIterationCount": true, |
6495
|
|
|
"columnCount": true, |
6496
|
|
|
"fillOpacity": true, |
6497
|
|
|
"flexGrow": true, |
6498
|
|
|
"flexShrink": true, |
6499
|
|
|
"fontWeight": true, |
6500
|
|
|
"lineHeight": true, |
6501
|
|
|
"opacity": true, |
6502
|
|
|
"order": true, |
6503
|
|
|
"orphans": true, |
6504
|
|
|
"widows": true, |
6505
|
|
|
"zIndex": true, |
6506
|
|
|
"zoom": true |
6507
|
|
|
}, |
6508
|
|
|
|
6509
|
|
|
// Add in properties whose names you wish to fix before |
6510
|
|
|
// setting or getting the value |
6511
|
|
|
cssProps: {}, |
6512
|
|
|
|
6513
|
|
|
// Get and set the style property on a DOM Node |
6514
|
|
|
style: function( elem, name, value, extra ) { |
6515
|
|
|
|
6516
|
|
|
// Don't set styles on text and comment nodes |
6517
|
|
|
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { |
6518
|
|
|
return; |
6519
|
|
|
} |
6520
|
|
|
|
6521
|
|
|
// Make sure that we're working with the right name |
6522
|
|
|
var ret, type, hooks, |
6523
|
|
|
origName = camelCase( name ), |
6524
|
|
|
isCustomProp = rcustomProp.test( name ), |
6525
|
|
|
style = elem.style; |
6526
|
|
|
|
6527
|
|
|
// Make sure that we're working with the right name. We don't |
6528
|
|
|
// want to query the value if it is a CSS custom property |
6529
|
|
|
// since they are user-defined. |
6530
|
|
|
if ( !isCustomProp ) { |
6531
|
|
|
name = finalPropName( origName ); |
6532
|
|
|
} |
6533
|
|
|
|
6534
|
|
|
// Gets hook for the prefixed version, then unprefixed version |
6535
|
|
|
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
6536
|
|
|
|
6537
|
|
|
// Check if we're setting a value |
6538
|
|
|
if ( value !== undefined ) { |
6539
|
|
|
type = typeof value; |
6540
|
|
|
|
6541
|
|
|
// Convert "+=" or "-=" to relative numbers (#7345) |
6542
|
|
|
if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { |
6543
|
|
|
value = adjustCSS( elem, name, ret ); |
6544
|
|
|
|
6545
|
|
|
// Fixes bug #9237 |
6546
|
|
|
type = "number"; |
6547
|
|
|
} |
6548
|
|
|
|
6549
|
|
|
// Make sure that null and NaN values aren't set (#7116) |
6550
|
|
|
if ( value == null || value !== value ) { |
6551
|
|
|
return; |
6552
|
|
|
} |
6553
|
|
|
|
6554
|
|
|
// If a number was passed in, add the unit (except for certain CSS properties) |
6555
|
|
|
if ( type === "number" ) { |
6556
|
|
|
value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); |
6557
|
|
|
} |
6558
|
|
|
|
6559
|
|
|
// background-* props affect original clone's values |
6560
|
|
|
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { |
6561
|
|
|
style[ name ] = "inherit"; |
6562
|
|
|
} |
6563
|
|
|
|
6564
|
|
|
// If a hook was provided, use that value, otherwise just set the specified value |
6565
|
|
|
if ( !hooks || !( "set" in hooks ) || |
6566
|
|
|
( value = hooks.set( elem, value, extra ) ) !== undefined ) { |
6567
|
|
|
|
6568
|
|
|
if ( isCustomProp ) { |
6569
|
|
|
style.setProperty( name, value ); |
6570
|
|
|
} else { |
6571
|
|
|
style[ name ] = value; |
6572
|
|
|
} |
6573
|
|
|
} |
6574
|
|
|
|
6575
|
|
|
} else { |
6576
|
|
|
|
6577
|
|
|
// If a hook was provided get the non-computed value from there |
6578
|
|
|
if ( hooks && "get" in hooks && |
6579
|
|
|
( ret = hooks.get( elem, false, extra ) ) !== undefined ) { |
6580
|
|
|
|
6581
|
|
|
return ret; |
6582
|
|
|
} |
6583
|
|
|
|
6584
|
|
|
// Otherwise just get the value from the style object |
6585
|
|
|
return style[ name ]; |
6586
|
|
|
} |
6587
|
|
|
}, |
6588
|
|
|
|
6589
|
|
|
css: function( elem, name, extra, styles ) { |
6590
|
|
|
var val, num, hooks, |
6591
|
|
|
origName = camelCase( name ), |
6592
|
|
|
isCustomProp = rcustomProp.test( name ); |
6593
|
|
|
|
6594
|
|
|
// Make sure that we're working with the right name. We don't |
6595
|
|
|
// want to modify the value if it is a CSS custom property |
6596
|
|
|
// since they are user-defined. |
6597
|
|
|
if ( !isCustomProp ) { |
6598
|
|
|
name = finalPropName( origName ); |
6599
|
|
|
} |
6600
|
|
|
|
6601
|
|
|
// Try prefixed name followed by the unprefixed name |
6602
|
|
|
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
6603
|
|
|
|
6604
|
|
|
// If a hook was provided get the computed value from there |
6605
|
|
|
if ( hooks && "get" in hooks ) { |
6606
|
|
|
val = hooks.get( elem, true, extra ); |
6607
|
|
|
} |
6608
|
|
|
|
6609
|
|
|
// Otherwise, if a way to get the computed value exists, use that |
6610
|
|
|
if ( val === undefined ) { |
6611
|
|
|
val = curCSS( elem, name, styles ); |
6612
|
|
|
} |
6613
|
|
|
|
6614
|
|
|
// Convert "normal" to computed value |
6615
|
|
|
if ( val === "normal" && name in cssNormalTransform ) { |
6616
|
|
|
val = cssNormalTransform[ name ]; |
6617
|
|
|
} |
6618
|
|
|
|
6619
|
|
|
// Make numeric if forced or a qualifier was provided and val looks numeric |
6620
|
|
|
if ( extra === "" || extra ) { |
6621
|
|
|
num = parseFloat( val ); |
6622
|
|
|
return extra === true || isFinite( num ) ? num || 0 : val; |
6623
|
|
|
} |
6624
|
|
|
|
6625
|
|
|
return val; |
6626
|
|
|
} |
6627
|
|
|
} ); |
6628
|
|
|
|
6629
|
|
|
jQuery.each( [ "height", "width" ], function( i, dimension ) { |
6630
|
|
|
jQuery.cssHooks[ dimension ] = { |
6631
|
|
|
get: function( elem, computed, extra ) { |
6632
|
|
|
if ( computed ) { |
6633
|
|
|
|
6634
|
|
|
// Certain elements can have dimension info if we invisibly show them |
6635
|
|
|
// but it must have a current display style that would benefit |
6636
|
|
|
return rdisplayswap.test( jQuery.css( elem, "display" ) ) && |
6637
|
|
|
|
6638
|
|
|
// Support: Safari 8+ |
6639
|
|
|
// Table columns in Safari have non-zero offsetWidth & zero |
6640
|
|
|
// getBoundingClientRect().width unless display is changed. |
6641
|
|
|
// Support: IE <=11 only |
6642
|
|
|
// Running getBoundingClientRect on a disconnected node |
6643
|
|
|
// in IE throws an error. |
6644
|
|
|
( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? |
6645
|
|
|
swap( elem, cssShow, function() { |
6646
|
|
|
return getWidthOrHeight( elem, dimension, extra ); |
6647
|
|
|
} ) : |
6648
|
|
|
getWidthOrHeight( elem, dimension, extra ); |
6649
|
|
|
} |
6650
|
|
|
}, |
6651
|
|
|
|
6652
|
|
|
set: function( elem, value, extra ) { |
6653
|
|
|
var matches, |
6654
|
|
|
styles = getStyles( elem ), |
6655
|
|
|
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", |
6656
|
|
|
subtract = extra && boxModelAdjustment( |
6657
|
|
|
elem, |
6658
|
|
|
dimension, |
6659
|
|
|
extra, |
6660
|
|
|
isBorderBox, |
6661
|
|
|
styles |
6662
|
|
|
); |
6663
|
|
|
|
6664
|
|
|
// Account for unreliable border-box dimensions by comparing offset* to computed and |
6665
|
|
|
// faking a content-box to get border and padding (gh-3699) |
6666
|
|
|
if ( isBorderBox && support.scrollboxSize() === styles.position ) { |
6667
|
|
|
subtract -= Math.ceil( |
6668
|
|
|
elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - |
6669
|
|
|
parseFloat( styles[ dimension ] ) - |
6670
|
|
|
boxModelAdjustment( elem, dimension, "border", false, styles ) - |
6671
|
|
|
0.5 |
6672
|
|
|
); |
6673
|
|
|
} |
6674
|
|
|
|
6675
|
|
|
// Convert to pixels if value adjustment is needed |
6676
|
|
|
if ( subtract && ( matches = rcssNum.exec( value ) ) && |
6677
|
|
|
( matches[ 3 ] || "px" ) !== "px" ) { |
6678
|
|
|
|
6679
|
|
|
elem.style[ dimension ] = value; |
6680
|
|
|
value = jQuery.css( elem, dimension ); |
6681
|
|
|
} |
6682
|
|
|
|
6683
|
|
|
return setPositiveNumber( elem, value, subtract ); |
6684
|
|
|
} |
6685
|
|
|
}; |
6686
|
|
|
} ); |
6687
|
|
|
|
6688
|
|
|
jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, |
6689
|
|
|
function( elem, computed ) { |
6690
|
|
|
if ( computed ) { |
6691
|
|
|
return ( parseFloat( curCSS( elem, "marginLeft" ) ) || |
6692
|
|
|
elem.getBoundingClientRect().left - |
6693
|
|
|
swap( elem, { marginLeft: 0 }, function() { |
6694
|
|
|
return elem.getBoundingClientRect().left; |
6695
|
|
|
} ) |
6696
|
|
|
) + "px"; |
6697
|
|
|
} |
6698
|
|
|
} |
6699
|
|
|
); |
6700
|
|
|
|
6701
|
|
|
// These hooks are used by animate to expand properties |
6702
|
|
|
jQuery.each( { |
6703
|
|
|
margin: "", |
6704
|
|
|
padding: "", |
6705
|
|
|
border: "Width" |
6706
|
|
|
}, function( prefix, suffix ) { |
6707
|
|
|
jQuery.cssHooks[ prefix + suffix ] = { |
6708
|
|
|
expand: function( value ) { |
6709
|
|
|
var i = 0, |
6710
|
|
|
expanded = {}, |
6711
|
|
|
|
6712
|
|
|
// Assumes a single number if not a string |
6713
|
|
|
parts = typeof value === "string" ? value.split( " " ) : [ value ]; |
6714
|
|
|
|
6715
|
|
|
for ( ; i < 4; i++ ) { |
6716
|
|
|
expanded[ prefix + cssExpand[ i ] + suffix ] = |
6717
|
|
|
parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; |
6718
|
|
|
} |
6719
|
|
|
|
6720
|
|
|
return expanded; |
6721
|
|
|
} |
6722
|
|
|
}; |
6723
|
|
|
|
6724
|
|
|
if ( prefix !== "margin" ) { |
6725
|
|
|
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; |
6726
|
|
|
} |
6727
|
|
|
} ); |
6728
|
|
|
|
6729
|
|
|
jQuery.fn.extend( { |
6730
|
|
|
css: function( name, value ) { |
6731
|
|
|
return access( this, function( elem, name, value ) { |
6732
|
|
|
var styles, len, |
6733
|
|
|
map = {}, |
6734
|
|
|
i = 0; |
6735
|
|
|
|
6736
|
|
|
if ( Array.isArray( name ) ) { |
6737
|
|
|
styles = getStyles( elem ); |
6738
|
|
|
len = name.length; |
6739
|
|
|
|
6740
|
|
|
for ( ; i < len; i++ ) { |
6741
|
|
|
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); |
6742
|
|
|
} |
6743
|
|
|
|
6744
|
|
|
return map; |
6745
|
|
|
} |
6746
|
|
|
|
6747
|
|
|
return value !== undefined ? |
6748
|
|
|
jQuery.style( elem, name, value ) : |
6749
|
|
|
jQuery.css( elem, name ); |
6750
|
|
|
}, name, value, arguments.length > 1 ); |
6751
|
|
|
} |
6752
|
|
|
} ); |
6753
|
|
|
|
6754
|
|
|
|
6755
|
|
|
function Tween( elem, options, prop, end, easing ) { |
6756
|
|
|
return new Tween.prototype.init( elem, options, prop, end, easing ); |
6757
|
|
|
} |
6758
|
|
|
jQuery.Tween = Tween; |
6759
|
|
|
|
6760
|
|
|
Tween.prototype = { |
6761
|
|
|
constructor: Tween, |
6762
|
|
|
init: function( elem, options, prop, end, easing, unit ) { |
6763
|
|
|
this.elem = elem; |
6764
|
|
|
this.prop = prop; |
6765
|
|
|
this.easing = easing || jQuery.easing._default; |
6766
|
|
|
this.options = options; |
6767
|
|
|
this.start = this.now = this.cur(); |
6768
|
|
|
this.end = end; |
6769
|
|
|
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); |
6770
|
|
|
}, |
6771
|
|
|
cur: function() { |
6772
|
|
|
var hooks = Tween.propHooks[ this.prop ]; |
6773
|
|
|
|
6774
|
|
|
return hooks && hooks.get ? |
6775
|
|
|
hooks.get( this ) : |
6776
|
|
|
Tween.propHooks._default.get( this ); |
6777
|
|
|
}, |
6778
|
|
|
run: function( percent ) { |
6779
|
|
|
var eased, |
6780
|
|
|
hooks = Tween.propHooks[ this.prop ]; |
6781
|
|
|
|
6782
|
|
|
if ( this.options.duration ) { |
6783
|
|
|
this.pos = eased = jQuery.easing[ this.easing ]( |
6784
|
|
|
percent, this.options.duration * percent, 0, 1, this.options.duration |
6785
|
|
|
); |
6786
|
|
|
} else { |
6787
|
|
|
this.pos = eased = percent; |
6788
|
|
|
} |
6789
|
|
|
this.now = ( this.end - this.start ) * eased + this.start; |
6790
|
|
|
|
6791
|
|
|
if ( this.options.step ) { |
6792
|
|
|
this.options.step.call( this.elem, this.now, this ); |
6793
|
|
|
} |
6794
|
|
|
|
6795
|
|
|
if ( hooks && hooks.set ) { |
6796
|
|
|
hooks.set( this ); |
6797
|
|
|
} else { |
6798
|
|
|
Tween.propHooks._default.set( this ); |
6799
|
|
|
} |
6800
|
|
|
return this; |
6801
|
|
|
} |
6802
|
|
|
}; |
6803
|
|
|
|
6804
|
|
|
Tween.prototype.init.prototype = Tween.prototype; |
6805
|
|
|
|
6806
|
|
|
Tween.propHooks = { |
6807
|
|
|
_default: { |
6808
|
|
|
get: function( tween ) { |
6809
|
|
|
var result; |
6810
|
|
|
|
6811
|
|
|
// Use a property on the element directly when it is not a DOM element, |
6812
|
|
|
// or when there is no matching style property that exists. |
6813
|
|
|
if ( tween.elem.nodeType !== 1 || |
6814
|
|
|
tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { |
6815
|
|
|
return tween.elem[ tween.prop ]; |
6816
|
|
|
} |
6817
|
|
|
|
6818
|
|
|
// Passing an empty string as a 3rd parameter to .css will automatically |
6819
|
|
|
// attempt a parseFloat and fallback to a string if the parse fails. |
6820
|
|
|
// Simple values such as "10px" are parsed to Float; |
6821
|
|
|
// complex values such as "rotate(1rad)" are returned as-is. |
6822
|
|
|
result = jQuery.css( tween.elem, tween.prop, "" ); |
6823
|
|
|
|
6824
|
|
|
// Empty strings, null, undefined and "auto" are converted to 0. |
6825
|
|
|
return !result || result === "auto" ? 0 : result; |
6826
|
|
|
}, |
6827
|
|
|
set: function( tween ) { |
6828
|
|
|
|
6829
|
|
|
// Use step hook for back compat. |
6830
|
|
|
// Use cssHook if its there. |
6831
|
|
|
// Use .style if available and use plain properties where available. |
6832
|
|
|
if ( jQuery.fx.step[ tween.prop ] ) { |
6833
|
|
|
jQuery.fx.step[ tween.prop ]( tween ); |
6834
|
|
|
} else if ( tween.elem.nodeType === 1 && |
6835
|
|
|
( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || |
6836
|
|
|
jQuery.cssHooks[ tween.prop ] ) ) { |
6837
|
|
|
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); |
6838
|
|
|
} else { |
6839
|
|
|
tween.elem[ tween.prop ] = tween.now; |
6840
|
|
|
} |
6841
|
|
|
} |
6842
|
|
|
} |
6843
|
|
|
}; |
6844
|
|
|
|
6845
|
|
|
// Support: IE <=9 only |
6846
|
|
|
// Panic based approach to setting things on disconnected nodes |
6847
|
|
|
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { |
6848
|
|
|
set: function( tween ) { |
6849
|
|
|
if ( tween.elem.nodeType && tween.elem.parentNode ) { |
6850
|
|
|
tween.elem[ tween.prop ] = tween.now; |
6851
|
|
|
} |
6852
|
|
|
} |
6853
|
|
|
}; |
6854
|
|
|
|
6855
|
|
|
jQuery.easing = { |
6856
|
|
|
linear: function( p ) { |
6857
|
|
|
return p; |
6858
|
|
|
}, |
6859
|
|
|
swing: function( p ) { |
6860
|
|
|
return 0.5 - Math.cos( p * Math.PI ) / 2; |
6861
|
|
|
}, |
6862
|
|
|
_default: "swing" |
6863
|
|
|
}; |
6864
|
|
|
|
6865
|
|
|
jQuery.fx = Tween.prototype.init; |
6866
|
|
|
|
6867
|
|
|
// Back compat <1.8 extension point |
6868
|
|
|
jQuery.fx.step = {}; |
6869
|
|
|
|
6870
|
|
|
|
6871
|
|
|
|
6872
|
|
|
|
6873
|
|
|
var |
6874
|
|
|
fxNow, inProgress, |
6875
|
|
|
rfxtypes = /^(?:toggle|show|hide)$/, |
6876
|
|
|
rrun = /queueHooks$/; |
6877
|
|
|
|
6878
|
|
|
function schedule() { |
6879
|
|
|
if ( inProgress ) { |
6880
|
|
|
if ( document.hidden === false && window.requestAnimationFrame ) { |
6881
|
|
|
window.requestAnimationFrame( schedule ); |
6882
|
|
|
} else { |
6883
|
|
|
window.setTimeout( schedule, jQuery.fx.interval ); |
6884
|
|
|
} |
6885
|
|
|
|
6886
|
|
|
jQuery.fx.tick(); |
6887
|
|
|
} |
6888
|
|
|
} |
6889
|
|
|
|
6890
|
|
|
// Animations created synchronously will run synchronously |
6891
|
|
|
function createFxNow() { |
6892
|
|
|
window.setTimeout( function() { |
6893
|
|
|
fxNow = undefined; |
6894
|
|
|
} ); |
6895
|
|
|
return ( fxNow = Date.now() ); |
6896
|
|
|
} |
6897
|
|
|
|
6898
|
|
|
// Generate parameters to create a standard animation |
6899
|
|
|
function genFx( type, includeWidth ) { |
6900
|
|
|
var which, |
6901
|
|
|
i = 0, |
6902
|
|
|
attrs = { height: type }; |
6903
|
|
|
|
6904
|
|
|
// If we include width, step value is 1 to do all cssExpand values, |
6905
|
|
|
// otherwise step value is 2 to skip over Left and Right |
6906
|
|
|
includeWidth = includeWidth ? 1 : 0; |
6907
|
|
|
for ( ; i < 4; i += 2 - includeWidth ) { |
6908
|
|
|
which = cssExpand[ i ]; |
6909
|
|
|
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; |
6910
|
|
|
} |
6911
|
|
|
|
6912
|
|
|
if ( includeWidth ) { |
6913
|
|
|
attrs.opacity = attrs.width = type; |
6914
|
|
|
} |
6915
|
|
|
|
6916
|
|
|
return attrs; |
6917
|
|
|
} |
6918
|
|
|
|
6919
|
|
|
function createTween( value, prop, animation ) { |
6920
|
|
|
var tween, |
6921
|
|
|
collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), |
6922
|
|
|
index = 0, |
6923
|
|
|
length = collection.length; |
6924
|
|
|
for ( ; index < length; index++ ) { |
6925
|
|
|
if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { |
6926
|
|
|
|
6927
|
|
|
// We're done with this property |
6928
|
|
|
return tween; |
6929
|
|
|
} |
6930
|
|
|
} |
6931
|
|
|
} |
6932
|
|
|
|
6933
|
|
|
function defaultPrefilter( elem, props, opts ) { |
6934
|
|
|
var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, |
6935
|
|
|
isBox = "width" in props || "height" in props, |
6936
|
|
|
anim = this, |
6937
|
|
|
orig = {}, |
6938
|
|
|
style = elem.style, |
6939
|
|
|
hidden = elem.nodeType && isHiddenWithinTree( elem ), |
6940
|
|
|
dataShow = dataPriv.get( elem, "fxshow" ); |
6941
|
|
|
|
6942
|
|
|
// Queue-skipping animations hijack the fx hooks |
6943
|
|
|
if ( !opts.queue ) { |
6944
|
|
|
hooks = jQuery._queueHooks( elem, "fx" ); |
6945
|
|
|
if ( hooks.unqueued == null ) { |
6946
|
|
|
hooks.unqueued = 0; |
6947
|
|
|
oldfire = hooks.empty.fire; |
6948
|
|
|
hooks.empty.fire = function() { |
6949
|
|
|
if ( !hooks.unqueued ) { |
6950
|
|
|
oldfire(); |
6951
|
|
|
} |
6952
|
|
|
}; |
6953
|
|
|
} |
6954
|
|
|
hooks.unqueued++; |
6955
|
|
|
|
6956
|
|
|
anim.always( function() { |
6957
|
|
|
|
6958
|
|
|
// Ensure the complete handler is called before this completes |
6959
|
|
|
anim.always( function() { |
6960
|
|
|
hooks.unqueued--; |
6961
|
|
|
if ( !jQuery.queue( elem, "fx" ).length ) { |
6962
|
|
|
hooks.empty.fire(); |
6963
|
|
|
} |
6964
|
|
|
} ); |
6965
|
|
|
} ); |
6966
|
|
|
} |
6967
|
|
|
|
6968
|
|
|
// Detect show/hide animations |
6969
|
|
|
for ( prop in props ) { |
6970
|
|
|
value = props[ prop ]; |
6971
|
|
|
if ( rfxtypes.test( value ) ) { |
6972
|
|
|
delete props[ prop ]; |
6973
|
|
|
toggle = toggle || value === "toggle"; |
6974
|
|
|
if ( value === ( hidden ? "hide" : "show" ) ) { |
6975
|
|
|
|
6976
|
|
|
// Pretend to be hidden if this is a "show" and |
6977
|
|
|
// there is still data from a stopped show/hide |
6978
|
|
|
if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { |
6979
|
|
|
hidden = true; |
6980
|
|
|
|
6981
|
|
|
// Ignore all other no-op show/hide data |
6982
|
|
|
} else { |
6983
|
|
|
continue; |
6984
|
|
|
} |
6985
|
|
|
} |
6986
|
|
|
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); |
6987
|
|
|
} |
6988
|
|
|
} |
6989
|
|
|
|
6990
|
|
|
// Bail out if this is a no-op like .hide().hide() |
6991
|
|
|
propTween = !jQuery.isEmptyObject( props ); |
6992
|
|
|
if ( !propTween && jQuery.isEmptyObject( orig ) ) { |
6993
|
|
|
return; |
6994
|
|
|
} |
6995
|
|
|
|
6996
|
|
|
// Restrict "overflow" and "display" styles during box animations |
6997
|
|
|
if ( isBox && elem.nodeType === 1 ) { |
6998
|
|
|
|
6999
|
|
|
// Support: IE <=9 - 11, Edge 12 - 15 |
7000
|
|
|
// Record all 3 overflow attributes because IE does not infer the shorthand |
7001
|
|
|
// from identically-valued overflowX and overflowY and Edge just mirrors |
7002
|
|
|
// the overflowX value there. |
7003
|
|
|
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; |
7004
|
|
|
|
7005
|
|
|
// Identify a display type, preferring old show/hide data over the CSS cascade |
7006
|
|
|
restoreDisplay = dataShow && dataShow.display; |
7007
|
|
|
if ( restoreDisplay == null ) { |
7008
|
|
|
restoreDisplay = dataPriv.get( elem, "display" ); |
7009
|
|
|
} |
7010
|
|
|
display = jQuery.css( elem, "display" ); |
7011
|
|
|
if ( display === "none" ) { |
7012
|
|
|
if ( restoreDisplay ) { |
7013
|
|
|
display = restoreDisplay; |
7014
|
|
|
} else { |
7015
|
|
|
|
7016
|
|
|
// Get nonempty value(s) by temporarily forcing visibility |
7017
|
|
|
showHide( [ elem ], true ); |
7018
|
|
|
restoreDisplay = elem.style.display || restoreDisplay; |
7019
|
|
|
display = jQuery.css( elem, "display" ); |
7020
|
|
|
showHide( [ elem ] ); |
7021
|
|
|
} |
7022
|
|
|
} |
7023
|
|
|
|
7024
|
|
|
// Animate inline elements as inline-block |
7025
|
|
|
if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { |
7026
|
|
|
if ( jQuery.css( elem, "float" ) === "none" ) { |
7027
|
|
|
|
7028
|
|
|
// Restore the original display value at the end of pure show/hide animations |
7029
|
|
|
if ( !propTween ) { |
7030
|
|
|
anim.done( function() { |
7031
|
|
|
style.display = restoreDisplay; |
7032
|
|
|
} ); |
7033
|
|
|
if ( restoreDisplay == null ) { |
7034
|
|
|
display = style.display; |
7035
|
|
|
restoreDisplay = display === "none" ? "" : display; |
7036
|
|
|
} |
7037
|
|
|
} |
7038
|
|
|
style.display = "inline-block"; |
7039
|
|
|
} |
7040
|
|
|
} |
7041
|
|
|
} |
7042
|
|
|
|
7043
|
|
|
if ( opts.overflow ) { |
7044
|
|
|
style.overflow = "hidden"; |
7045
|
|
|
anim.always( function() { |
7046
|
|
|
style.overflow = opts.overflow[ 0 ]; |
7047
|
|
|
style.overflowX = opts.overflow[ 1 ]; |
7048
|
|
|
style.overflowY = opts.overflow[ 2 ]; |
7049
|
|
|
} ); |
7050
|
|
|
} |
7051
|
|
|
|
7052
|
|
|
// Implement show/hide animations |
7053
|
|
|
propTween = false; |
7054
|
|
|
for ( prop in orig ) { |
7055
|
|
|
|
7056
|
|
|
// General show/hide setup for this element animation |
7057
|
|
|
if ( !propTween ) { |
7058
|
|
|
if ( dataShow ) { |
7059
|
|
|
if ( "hidden" in dataShow ) { |
7060
|
|
|
hidden = dataShow.hidden; |
7061
|
|
|
} |
7062
|
|
|
} else { |
7063
|
|
|
dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); |
7064
|
|
|
} |
7065
|
|
|
|
7066
|
|
|
// Store hidden/visible for toggle so `.stop().toggle()` "reverses" |
7067
|
|
|
if ( toggle ) { |
7068
|
|
|
dataShow.hidden = !hidden; |
7069
|
|
|
} |
7070
|
|
|
|
7071
|
|
|
// Show elements before animating them |
7072
|
|
|
if ( hidden ) { |
7073
|
|
|
showHide( [ elem ], true ); |
7074
|
|
|
} |
7075
|
|
|
|
7076
|
|
|
/* eslint-disable no-loop-func */ |
7077
|
|
|
|
7078
|
|
|
anim.done( function() { |
7079
|
|
|
|
7080
|
|
|
/* eslint-enable no-loop-func */ |
7081
|
|
|
|
7082
|
|
|
// The final step of a "hide" animation is actually hiding the element |
7083
|
|
|
if ( !hidden ) { |
7084
|
|
|
showHide( [ elem ] ); |
7085
|
|
|
} |
7086
|
|
|
dataPriv.remove( elem, "fxshow" ); |
7087
|
|
|
for ( prop in orig ) { |
7088
|
|
|
jQuery.style( elem, prop, orig[ prop ] ); |
7089
|
|
|
} |
7090
|
|
|
} ); |
7091
|
|
|
} |
7092
|
|
|
|
7093
|
|
|
// Per-property setup |
7094
|
|
|
propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); |
7095
|
|
|
if ( !( prop in dataShow ) ) { |
7096
|
|
|
dataShow[ prop ] = propTween.start; |
7097
|
|
|
if ( hidden ) { |
7098
|
|
|
propTween.end = propTween.start; |
7099
|
|
|
propTween.start = 0; |
7100
|
|
|
} |
7101
|
|
|
} |
7102
|
|
|
} |
7103
|
|
|
} |
7104
|
|
|
|
7105
|
|
|
function propFilter( props, specialEasing ) { |
7106
|
|
|
var index, name, easing, value, hooks; |
7107
|
|
|
|
7108
|
|
|
// camelCase, specialEasing and expand cssHook pass |
7109
|
|
|
for ( index in props ) { |
7110
|
|
|
name = camelCase( index ); |
7111
|
|
|
easing = specialEasing[ name ]; |
7112
|
|
|
value = props[ index ]; |
7113
|
|
|
if ( Array.isArray( value ) ) { |
7114
|
|
|
easing = value[ 1 ]; |
7115
|
|
|
value = props[ index ] = value[ 0 ]; |
7116
|
|
|
} |
7117
|
|
|
|
7118
|
|
|
if ( index !== name ) { |
7119
|
|
|
props[ name ] = value; |
7120
|
|
|
delete props[ index ]; |
7121
|
|
|
} |
7122
|
|
|
|
7123
|
|
|
hooks = jQuery.cssHooks[ name ]; |
7124
|
|
|
if ( hooks && "expand" in hooks ) { |
7125
|
|
|
value = hooks.expand( value ); |
7126
|
|
|
delete props[ name ]; |
7127
|
|
|
|
7128
|
|
|
// Not quite $.extend, this won't overwrite existing keys. |
7129
|
|
|
// Reusing 'index' because we have the correct "name" |
7130
|
|
|
for ( index in value ) { |
7131
|
|
|
if ( !( index in props ) ) { |
7132
|
|
|
props[ index ] = value[ index ]; |
7133
|
|
|
specialEasing[ index ] = easing; |
7134
|
|
|
} |
7135
|
|
|
} |
7136
|
|
|
} else { |
7137
|
|
|
specialEasing[ name ] = easing; |
7138
|
|
|
} |
7139
|
|
|
} |
7140
|
|
|
} |
7141
|
|
|
|
7142
|
|
|
function Animation( elem, properties, options ) { |
7143
|
|
|
var result, |
7144
|
|
|
stopped, |
7145
|
|
|
index = 0, |
7146
|
|
|
length = Animation.prefilters.length, |
7147
|
|
|
deferred = jQuery.Deferred().always( function() { |
7148
|
|
|
|
7149
|
|
|
// Don't match elem in the :animated selector |
7150
|
|
|
delete tick.elem; |
7151
|
|
|
} ), |
7152
|
|
|
tick = function() { |
7153
|
|
|
if ( stopped ) { |
7154
|
|
|
return false; |
7155
|
|
|
} |
7156
|
|
|
var currentTime = fxNow || createFxNow(), |
7157
|
|
|
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
7158
|
|
|
|
7159
|
|
|
// Support: Android 2.3 only |
7160
|
|
|
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) |
7161
|
|
|
temp = remaining / animation.duration || 0, |
7162
|
|
|
percent = 1 - temp, |
7163
|
|
|
index = 0, |
7164
|
|
|
length = animation.tweens.length; |
7165
|
|
|
|
7166
|
|
|
for ( ; index < length; index++ ) { |
7167
|
|
|
animation.tweens[ index ].run( percent ); |
7168
|
|
|
} |
7169
|
|
|
|
7170
|
|
|
deferred.notifyWith( elem, [ animation, percent, remaining ] ); |
7171
|
|
|
|
7172
|
|
|
// If there's more to do, yield |
7173
|
|
|
if ( percent < 1 && length ) { |
7174
|
|
|
return remaining; |
7175
|
|
|
} |
7176
|
|
|
|
7177
|
|
|
// If this was an empty animation, synthesize a final progress notification |
7178
|
|
|
if ( !length ) { |
7179
|
|
|
deferred.notifyWith( elem, [ animation, 1, 0 ] ); |
7180
|
|
|
} |
7181
|
|
|
|
7182
|
|
|
// Resolve the animation and report its conclusion |
7183
|
|
|
deferred.resolveWith( elem, [ animation ] ); |
7184
|
|
|
return false; |
7185
|
|
|
}, |
7186
|
|
|
animation = deferred.promise( { |
7187
|
|
|
elem: elem, |
7188
|
|
|
props: jQuery.extend( {}, properties ), |
7189
|
|
|
opts: jQuery.extend( true, { |
7190
|
|
|
specialEasing: {}, |
7191
|
|
|
easing: jQuery.easing._default |
7192
|
|
|
}, options ), |
7193
|
|
|
originalProperties: properties, |
7194
|
|
|
originalOptions: options, |
7195
|
|
|
startTime: fxNow || createFxNow(), |
7196
|
|
|
duration: options.duration, |
7197
|
|
|
tweens: [], |
7198
|
|
|
createTween: function( prop, end ) { |
7199
|
|
|
var tween = jQuery.Tween( elem, animation.opts, prop, end, |
7200
|
|
|
animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
7201
|
|
|
animation.tweens.push( tween ); |
7202
|
|
|
return tween; |
7203
|
|
|
}, |
7204
|
|
|
stop: function( gotoEnd ) { |
7205
|
|
|
var index = 0, |
7206
|
|
|
|
7207
|
|
|
// If we are going to the end, we want to run all the tweens |
7208
|
|
|
// otherwise we skip this part |
7209
|
|
|
length = gotoEnd ? animation.tweens.length : 0; |
7210
|
|
|
if ( stopped ) { |
7211
|
|
|
return this; |
7212
|
|
|
} |
7213
|
|
|
stopped = true; |
7214
|
|
|
for ( ; index < length; index++ ) { |
7215
|
|
|
animation.tweens[ index ].run( 1 ); |
7216
|
|
|
} |
7217
|
|
|
|
7218
|
|
|
// Resolve when we played the last frame; otherwise, reject |
7219
|
|
|
if ( gotoEnd ) { |
7220
|
|
|
deferred.notifyWith( elem, [ animation, 1, 0 ] ); |
7221
|
|
|
deferred.resolveWith( elem, [ animation, gotoEnd ] ); |
7222
|
|
|
} else { |
7223
|
|
|
deferred.rejectWith( elem, [ animation, gotoEnd ] ); |
7224
|
|
|
} |
7225
|
|
|
return this; |
7226
|
|
|
} |
7227
|
|
|
} ), |
7228
|
|
|
props = animation.props; |
7229
|
|
|
|
7230
|
|
|
propFilter( props, animation.opts.specialEasing ); |
7231
|
|
|
|
7232
|
|
|
for ( ; index < length; index++ ) { |
7233
|
|
|
result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); |
7234
|
|
|
if ( result ) { |
7235
|
|
|
if ( isFunction( result.stop ) ) { |
7236
|
|
|
jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = |
7237
|
|
|
result.stop.bind( result ); |
7238
|
|
|
} |
7239
|
|
|
return result; |
7240
|
|
|
} |
7241
|
|
|
} |
7242
|
|
|
|
7243
|
|
|
jQuery.map( props, createTween, animation ); |
7244
|
|
|
|
7245
|
|
|
if ( isFunction( animation.opts.start ) ) { |
7246
|
|
|
animation.opts.start.call( elem, animation ); |
7247
|
|
|
} |
7248
|
|
|
|
7249
|
|
|
// Attach callbacks from options |
7250
|
|
|
animation |
7251
|
|
|
.progress( animation.opts.progress ) |
7252
|
|
|
.done( animation.opts.done, animation.opts.complete ) |
7253
|
|
|
.fail( animation.opts.fail ) |
7254
|
|
|
.always( animation.opts.always ); |
7255
|
|
|
|
7256
|
|
|
jQuery.fx.timer( |
7257
|
|
|
jQuery.extend( tick, { |
7258
|
|
|
elem: elem, |
7259
|
|
|
anim: animation, |
7260
|
|
|
queue: animation.opts.queue |
7261
|
|
|
} ) |
7262
|
|
|
); |
7263
|
|
|
|
7264
|
|
|
return animation; |
7265
|
|
|
} |
7266
|
|
|
|
7267
|
|
|
jQuery.Animation = jQuery.extend( Animation, { |
7268
|
|
|
|
7269
|
|
|
tweeners: { |
7270
|
|
|
"*": [ function( prop, value ) { |
7271
|
|
|
var tween = this.createTween( prop, value ); |
7272
|
|
|
adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); |
7273
|
|
|
return tween; |
7274
|
|
|
} ] |
7275
|
|
|
}, |
7276
|
|
|
|
7277
|
|
|
tweener: function( props, callback ) { |
7278
|
|
|
if ( isFunction( props ) ) { |
7279
|
|
|
callback = props; |
7280
|
|
|
props = [ "*" ]; |
7281
|
|
|
} else { |
7282
|
|
|
props = props.match( rnothtmlwhite ); |
7283
|
|
|
} |
7284
|
|
|
|
7285
|
|
|
var prop, |
7286
|
|
|
index = 0, |
7287
|
|
|
length = props.length; |
7288
|
|
|
|
7289
|
|
|
for ( ; index < length; index++ ) { |
7290
|
|
|
prop = props[ index ]; |
7291
|
|
|
Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; |
7292
|
|
|
Animation.tweeners[ prop ].unshift( callback ); |
7293
|
|
|
} |
7294
|
|
|
}, |
7295
|
|
|
|
7296
|
|
|
prefilters: [ defaultPrefilter ], |
7297
|
|
|
|
7298
|
|
|
prefilter: function( callback, prepend ) { |
7299
|
|
|
if ( prepend ) { |
7300
|
|
|
Animation.prefilters.unshift( callback ); |
7301
|
|
|
} else { |
7302
|
|
|
Animation.prefilters.push( callback ); |
7303
|
|
|
} |
7304
|
|
|
} |
7305
|
|
|
} ); |
7306
|
|
|
|
7307
|
|
|
jQuery.speed = function( speed, easing, fn ) { |
7308
|
|
|
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { |
7309
|
|
|
complete: fn || !fn && easing || |
7310
|
|
|
isFunction( speed ) && speed, |
7311
|
|
|
duration: speed, |
7312
|
|
|
easing: fn && easing || easing && !isFunction( easing ) && easing |
7313
|
|
|
}; |
7314
|
|
|
|
7315
|
|
|
// Go to the end state if fx are off |
7316
|
|
|
if ( jQuery.fx.off ) { |
7317
|
|
|
opt.duration = 0; |
7318
|
|
|
|
7319
|
|
|
} else { |
7320
|
|
|
if ( typeof opt.duration !== "number" ) { |
7321
|
|
|
if ( opt.duration in jQuery.fx.speeds ) { |
7322
|
|
|
opt.duration = jQuery.fx.speeds[ opt.duration ]; |
7323
|
|
|
|
7324
|
|
|
} else { |
7325
|
|
|
opt.duration = jQuery.fx.speeds._default; |
7326
|
|
|
} |
7327
|
|
|
} |
7328
|
|
|
} |
7329
|
|
|
|
7330
|
|
|
// Normalize opt.queue - true/undefined/null -> "fx" |
7331
|
|
|
if ( opt.queue == null || opt.queue === true ) { |
7332
|
|
|
opt.queue = "fx"; |
7333
|
|
|
} |
7334
|
|
|
|
7335
|
|
|
// Queueing |
7336
|
|
|
opt.old = opt.complete; |
7337
|
|
|
|
7338
|
|
|
opt.complete = function() { |
7339
|
|
|
if ( isFunction( opt.old ) ) { |
7340
|
|
|
opt.old.call( this ); |
7341
|
|
|
} |
7342
|
|
|
|
7343
|
|
|
if ( opt.queue ) { |
7344
|
|
|
jQuery.dequeue( this, opt.queue ); |
7345
|
|
|
} |
7346
|
|
|
}; |
7347
|
|
|
|
7348
|
|
|
return opt; |
7349
|
|
|
}; |
7350
|
|
|
|
7351
|
|
|
jQuery.fn.extend( { |
7352
|
|
|
fadeTo: function( speed, to, easing, callback ) { |
7353
|
|
|
|
7354
|
|
|
// Show any hidden elements after setting opacity to 0 |
7355
|
|
|
return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() |
7356
|
|
|
|
7357
|
|
|
// Animate to the value specified |
7358
|
|
|
.end().animate( { opacity: to }, speed, easing, callback ); |
7359
|
|
|
}, |
7360
|
|
|
animate: function( prop, speed, easing, callback ) { |
7361
|
|
|
var empty = jQuery.isEmptyObject( prop ), |
7362
|
|
|
optall = jQuery.speed( speed, easing, callback ), |
7363
|
|
|
doAnimation = function() { |
7364
|
|
|
|
7365
|
|
|
// Operate on a copy of prop so per-property easing won't be lost |
7366
|
|
|
var anim = Animation( this, jQuery.extend( {}, prop ), optall ); |
7367
|
|
|
|
7368
|
|
|
// Empty animations, or finishing resolves immediately |
7369
|
|
|
if ( empty || dataPriv.get( this, "finish" ) ) { |
7370
|
|
|
anim.stop( true ); |
7371
|
|
|
} |
7372
|
|
|
}; |
7373
|
|
|
doAnimation.finish = doAnimation; |
7374
|
|
|
|
7375
|
|
|
return empty || optall.queue === false ? |
7376
|
|
|
this.each( doAnimation ) : |
7377
|
|
|
this.queue( optall.queue, doAnimation ); |
7378
|
|
|
}, |
7379
|
|
|
stop: function( type, clearQueue, gotoEnd ) { |
7380
|
|
|
var stopQueue = function( hooks ) { |
7381
|
|
|
var stop = hooks.stop; |
7382
|
|
|
delete hooks.stop; |
7383
|
|
|
stop( gotoEnd ); |
7384
|
|
|
}; |
7385
|
|
|
|
7386
|
|
|
if ( typeof type !== "string" ) { |
7387
|
|
|
gotoEnd = clearQueue; |
7388
|
|
|
clearQueue = type; |
7389
|
|
|
type = undefined; |
7390
|
|
|
} |
7391
|
|
|
if ( clearQueue && type !== false ) { |
7392
|
|
|
this.queue( type || "fx", [] ); |
7393
|
|
|
} |
7394
|
|
|
|
7395
|
|
|
return this.each( function() { |
7396
|
|
|
var dequeue = true, |
7397
|
|
|
index = type != null && type + "queueHooks", |
7398
|
|
|
timers = jQuery.timers, |
7399
|
|
|
data = dataPriv.get( this ); |
7400
|
|
|
|
7401
|
|
|
if ( index ) { |
7402
|
|
|
if ( data[ index ] && data[ index ].stop ) { |
7403
|
|
|
stopQueue( data[ index ] ); |
7404
|
|
|
} |
7405
|
|
|
} else { |
7406
|
|
|
for ( index in data ) { |
7407
|
|
|
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { |
7408
|
|
|
stopQueue( data[ index ] ); |
7409
|
|
|
} |
7410
|
|
|
} |
7411
|
|
|
} |
7412
|
|
|
|
7413
|
|
|
for ( index = timers.length; index--; ) { |
7414
|
|
|
if ( timers[ index ].elem === this && |
7415
|
|
|
( type == null || timers[ index ].queue === type ) ) { |
7416
|
|
|
|
7417
|
|
|
timers[ index ].anim.stop( gotoEnd ); |
7418
|
|
|
dequeue = false; |
7419
|
|
|
timers.splice( index, 1 ); |
7420
|
|
|
} |
7421
|
|
|
} |
7422
|
|
|
|
7423
|
|
|
// Start the next in the queue if the last step wasn't forced. |
7424
|
|
|
// Timers currently will call their complete callbacks, which |
7425
|
|
|
// will dequeue but only if they were gotoEnd. |
7426
|
|
|
if ( dequeue || !gotoEnd ) { |
7427
|
|
|
jQuery.dequeue( this, type ); |
7428
|
|
|
} |
7429
|
|
|
} ); |
7430
|
|
|
}, |
7431
|
|
|
finish: function( type ) { |
7432
|
|
|
if ( type !== false ) { |
7433
|
|
|
type = type || "fx"; |
7434
|
|
|
} |
7435
|
|
|
return this.each( function() { |
7436
|
|
|
var index, |
7437
|
|
|
data = dataPriv.get( this ), |
7438
|
|
|
queue = data[ type + "queue" ], |
7439
|
|
|
hooks = data[ type + "queueHooks" ], |
7440
|
|
|
timers = jQuery.timers, |
7441
|
|
|
length = queue ? queue.length : 0; |
7442
|
|
|
|
7443
|
|
|
// Enable finishing flag on private data |
7444
|
|
|
data.finish = true; |
7445
|
|
|
|
7446
|
|
|
// Empty the queue first |
7447
|
|
|
jQuery.queue( this, type, [] ); |
7448
|
|
|
|
7449
|
|
|
if ( hooks && hooks.stop ) { |
7450
|
|
|
hooks.stop.call( this, true ); |
7451
|
|
|
} |
7452
|
|
|
|
7453
|
|
|
// Look for any active animations, and finish them |
7454
|
|
|
for ( index = timers.length; index--; ) { |
7455
|
|
|
if ( timers[ index ].elem === this && timers[ index ].queue === type ) { |
7456
|
|
|
timers[ index ].anim.stop( true ); |
7457
|
|
|
timers.splice( index, 1 ); |
7458
|
|
|
} |
7459
|
|
|
} |
7460
|
|
|
|
7461
|
|
|
// Look for any animations in the old queue and finish them |
7462
|
|
|
for ( index = 0; index < length; index++ ) { |
7463
|
|
|
if ( queue[ index ] && queue[ index ].finish ) { |
7464
|
|
|
queue[ index ].finish.call( this ); |
7465
|
|
|
} |
7466
|
|
|
} |
7467
|
|
|
|
7468
|
|
|
// Turn off finishing flag |
7469
|
|
|
delete data.finish; |
7470
|
|
|
} ); |
7471
|
|
|
} |
7472
|
|
|
} ); |
7473
|
|
|
|
7474
|
|
|
jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { |
7475
|
|
|
var cssFn = jQuery.fn[ name ]; |
7476
|
|
|
jQuery.fn[ name ] = function( speed, easing, callback ) { |
7477
|
|
|
return speed == null || typeof speed === "boolean" ? |
7478
|
|
|
cssFn.apply( this, arguments ) : |
7479
|
|
|
this.animate( genFx( name, true ), speed, easing, callback ); |
7480
|
|
|
}; |
7481
|
|
|
} ); |
7482
|
|
|
|
7483
|
|
|
// Generate shortcuts for custom animations |
7484
|
|
|
jQuery.each( { |
7485
|
|
|
slideDown: genFx( "show" ), |
7486
|
|
|
slideUp: genFx( "hide" ), |
7487
|
|
|
slideToggle: genFx( "toggle" ), |
7488
|
|
|
fadeIn: { opacity: "show" }, |
7489
|
|
|
fadeOut: { opacity: "hide" }, |
7490
|
|
|
fadeToggle: { opacity: "toggle" } |
7491
|
|
|
}, function( name, props ) { |
7492
|
|
|
jQuery.fn[ name ] = function( speed, easing, callback ) { |
7493
|
|
|
return this.animate( props, speed, easing, callback ); |
7494
|
|
|
}; |
7495
|
|
|
} ); |
7496
|
|
|
|
7497
|
|
|
jQuery.timers = []; |
7498
|
|
|
jQuery.fx.tick = function() { |
7499
|
|
|
var timer, |
7500
|
|
|
i = 0, |
7501
|
|
|
timers = jQuery.timers; |
7502
|
|
|
|
7503
|
|
|
fxNow = Date.now(); |
7504
|
|
|
|
7505
|
|
|
for ( ; i < timers.length; i++ ) { |
7506
|
|
|
timer = timers[ i ]; |
7507
|
|
|
|
7508
|
|
|
// Run the timer and safely remove it when done (allowing for external removal) |
7509
|
|
|
if ( !timer() && timers[ i ] === timer ) { |
7510
|
|
|
timers.splice( i--, 1 ); |
7511
|
|
|
} |
7512
|
|
|
} |
7513
|
|
|
|
7514
|
|
|
if ( !timers.length ) { |
7515
|
|
|
jQuery.fx.stop(); |
7516
|
|
|
} |
7517
|
|
|
fxNow = undefined; |
7518
|
|
|
}; |
7519
|
|
|
|
7520
|
|
|
jQuery.fx.timer = function( timer ) { |
7521
|
|
|
jQuery.timers.push( timer ); |
7522
|
|
|
jQuery.fx.start(); |
7523
|
|
|
}; |
7524
|
|
|
|
7525
|
|
|
jQuery.fx.interval = 13; |
7526
|
|
|
jQuery.fx.start = function() { |
7527
|
|
|
if ( inProgress ) { |
7528
|
|
|
return; |
7529
|
|
|
} |
7530
|
|
|
|
7531
|
|
|
inProgress = true; |
7532
|
|
|
schedule(); |
7533
|
|
|
}; |
7534
|
|
|
|
7535
|
|
|
jQuery.fx.stop = function() { |
7536
|
|
|
inProgress = null; |
7537
|
|
|
}; |
7538
|
|
|
|
7539
|
|
|
jQuery.fx.speeds = { |
7540
|
|
|
slow: 600, |
7541
|
|
|
fast: 200, |
7542
|
|
|
|
7543
|
|
|
// Default speed |
7544
|
|
|
_default: 400 |
7545
|
|
|
}; |
7546
|
|
|
|
7547
|
|
|
|
7548
|
|
|
// Based off of the plugin by Clint Helfers, with permission. |
7549
|
|
|
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ |
7550
|
|
|
jQuery.fn.delay = function( time, type ) { |
7551
|
|
|
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; |
7552
|
|
|
type = type || "fx"; |
7553
|
|
|
|
7554
|
|
|
return this.queue( type, function( next, hooks ) { |
7555
|
|
|
var timeout = window.setTimeout( next, time ); |
7556
|
|
|
hooks.stop = function() { |
7557
|
|
|
window.clearTimeout( timeout ); |
7558
|
|
|
}; |
7559
|
|
|
} ); |
7560
|
|
|
}; |
7561
|
|
|
|
7562
|
|
|
|
7563
|
|
|
( function() { |
7564
|
|
|
var input = document.createElement( "input" ), |
7565
|
|
|
select = document.createElement( "select" ), |
7566
|
|
|
opt = select.appendChild( document.createElement( "option" ) ); |
7567
|
|
|
|
7568
|
|
|
input.type = "checkbox"; |
7569
|
|
|
|
7570
|
|
|
// Support: Android <=4.3 only |
7571
|
|
|
// Default value for a checkbox should be "on" |
7572
|
|
|
support.checkOn = input.value !== ""; |
7573
|
|
|
|
7574
|
|
|
// Support: IE <=11 only |
7575
|
|
|
// Must access selectedIndex to make default options select |
7576
|
|
|
support.optSelected = opt.selected; |
7577
|
|
|
|
7578
|
|
|
// Support: IE <=11 only |
7579
|
|
|
// An input loses its value after becoming a radio |
7580
|
|
|
input = document.createElement( "input" ); |
7581
|
|
|
input.value = "t"; |
7582
|
|
|
input.type = "radio"; |
7583
|
|
|
support.radioValue = input.value === "t"; |
7584
|
|
|
} )(); |
7585
|
|
|
|
7586
|
|
|
|
7587
|
|
|
var boolHook, |
7588
|
|
|
attrHandle = jQuery.expr.attrHandle; |
7589
|
|
|
|
7590
|
|
|
jQuery.fn.extend( { |
7591
|
|
|
attr: function( name, value ) { |
7592
|
|
|
return access( this, jQuery.attr, name, value, arguments.length > 1 ); |
7593
|
|
|
}, |
7594
|
|
|
|
7595
|
|
|
removeAttr: function( name ) { |
7596
|
|
|
return this.each( function() { |
7597
|
|
|
jQuery.removeAttr( this, name ); |
7598
|
|
|
} ); |
7599
|
|
|
} |
7600
|
|
|
} ); |
7601
|
|
|
|
7602
|
|
|
jQuery.extend( { |
7603
|
|
|
attr: function( elem, name, value ) { |
7604
|
|
|
var ret, hooks, |
7605
|
|
|
nType = elem.nodeType; |
7606
|
|
|
|
7607
|
|
|
// Don't get/set attributes on text, comment and attribute nodes |
7608
|
|
|
if ( nType === 3 || nType === 8 || nType === 2 ) { |
7609
|
|
|
return; |
7610
|
|
|
} |
7611
|
|
|
|
7612
|
|
|
// Fallback to prop when attributes are not supported |
7613
|
|
|
if ( typeof elem.getAttribute === "undefined" ) { |
7614
|
|
|
return jQuery.prop( elem, name, value ); |
7615
|
|
|
} |
7616
|
|
|
|
7617
|
|
|
// Attribute hooks are determined by the lowercase version |
7618
|
|
|
// Grab necessary hook if one is defined |
7619
|
|
|
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
7620
|
|
|
hooks = jQuery.attrHooks[ name.toLowerCase() ] || |
7621
|
|
|
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); |
7622
|
|
|
} |
7623
|
|
|
|
7624
|
|
|
if ( value !== undefined ) { |
7625
|
|
|
if ( value === null ) { |
7626
|
|
|
jQuery.removeAttr( elem, name ); |
7627
|
|
|
return; |
7628
|
|
|
} |
7629
|
|
|
|
7630
|
|
|
if ( hooks && "set" in hooks && |
7631
|
|
|
( ret = hooks.set( elem, value, name ) ) !== undefined ) { |
7632
|
|
|
return ret; |
7633
|
|
|
} |
7634
|
|
|
|
7635
|
|
|
elem.setAttribute( name, value + "" ); |
7636
|
|
|
return value; |
7637
|
|
|
} |
7638
|
|
|
|
7639
|
|
|
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { |
7640
|
|
|
return ret; |
7641
|
|
|
} |
7642
|
|
|
|
7643
|
|
|
ret = jQuery.find.attr( elem, name ); |
7644
|
|
|
|
7645
|
|
|
// Non-existent attributes return null, we normalize to undefined |
7646
|
|
|
return ret == null ? undefined : ret; |
7647
|
|
|
}, |
7648
|
|
|
|
7649
|
|
|
attrHooks: { |
7650
|
|
|
type: { |
7651
|
|
|
set: function( elem, value ) { |
7652
|
|
|
if ( !support.radioValue && value === "radio" && |
7653
|
|
|
nodeName( elem, "input" ) ) { |
7654
|
|
|
var val = elem.value; |
7655
|
|
|
elem.setAttribute( "type", value ); |
7656
|
|
|
if ( val ) { |
7657
|
|
|
elem.value = val; |
7658
|
|
|
} |
7659
|
|
|
return value; |
7660
|
|
|
} |
7661
|
|
|
} |
7662
|
|
|
} |
7663
|
|
|
}, |
7664
|
|
|
|
7665
|
|
|
removeAttr: function( elem, value ) { |
7666
|
|
|
var name, |
7667
|
|
|
i = 0, |
7668
|
|
|
|
7669
|
|
|
// Attribute names can contain non-HTML whitespace characters |
7670
|
|
|
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 |
7671
|
|
|
attrNames = value && value.match( rnothtmlwhite ); |
7672
|
|
|
|
7673
|
|
|
if ( attrNames && elem.nodeType === 1 ) { |
7674
|
|
|
while ( ( name = attrNames[ i++ ] ) ) { |
7675
|
|
|
elem.removeAttribute( name ); |
7676
|
|
|
} |
7677
|
|
|
} |
7678
|
|
|
} |
7679
|
|
|
} ); |
7680
|
|
|
|
7681
|
|
|
// Hooks for boolean attributes |
7682
|
|
|
boolHook = { |
7683
|
|
|
set: function( elem, value, name ) { |
7684
|
|
|
if ( value === false ) { |
7685
|
|
|
|
7686
|
|
|
// Remove boolean attributes when set to false |
7687
|
|
|
jQuery.removeAttr( elem, name ); |
7688
|
|
|
} else { |
7689
|
|
|
elem.setAttribute( name, name ); |
7690
|
|
|
} |
7691
|
|
|
return name; |
7692
|
|
|
} |
7693
|
|
|
}; |
7694
|
|
|
|
7695
|
|
|
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { |
7696
|
|
|
var getter = attrHandle[ name ] || jQuery.find.attr; |
7697
|
|
|
|
7698
|
|
|
attrHandle[ name ] = function( elem, name, isXML ) { |
7699
|
|
|
var ret, handle, |
7700
|
|
|
lowercaseName = name.toLowerCase(); |
7701
|
|
|
|
7702
|
|
|
if ( !isXML ) { |
7703
|
|
|
|
7704
|
|
|
// Avoid an infinite loop by temporarily removing this function from the getter |
7705
|
|
|
handle = attrHandle[ lowercaseName ]; |
7706
|
|
|
attrHandle[ lowercaseName ] = ret; |
7707
|
|
|
ret = getter( elem, name, isXML ) != null ? |
7708
|
|
|
lowercaseName : |
7709
|
|
|
null; |
7710
|
|
|
attrHandle[ lowercaseName ] = handle; |
7711
|
|
|
} |
7712
|
|
|
return ret; |
7713
|
|
|
}; |
7714
|
|
|
} ); |
7715
|
|
|
|
7716
|
|
|
|
7717
|
|
|
|
7718
|
|
|
|
7719
|
|
|
var rfocusable = /^(?:input|select|textarea|button)$/i, |
7720
|
|
|
rclickable = /^(?:a|area)$/i; |
7721
|
|
|
|
7722
|
|
|
jQuery.fn.extend( { |
7723
|
|
|
prop: function( name, value ) { |
7724
|
|
|
return access( this, jQuery.prop, name, value, arguments.length > 1 ); |
7725
|
|
|
}, |
7726
|
|
|
|
7727
|
|
|
removeProp: function( name ) { |
7728
|
|
|
return this.each( function() { |
7729
|
|
|
delete this[ jQuery.propFix[ name ] || name ]; |
7730
|
|
|
} ); |
7731
|
|
|
} |
7732
|
|
|
} ); |
7733
|
|
|
|
7734
|
|
|
jQuery.extend( { |
7735
|
|
|
prop: function( elem, name, value ) { |
7736
|
|
|
var ret, hooks, |
7737
|
|
|
nType = elem.nodeType; |
7738
|
|
|
|
7739
|
|
|
// Don't get/set properties on text, comment and attribute nodes |
7740
|
|
|
if ( nType === 3 || nType === 8 || nType === 2 ) { |
7741
|
|
|
return; |
7742
|
|
|
} |
7743
|
|
|
|
7744
|
|
|
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
7745
|
|
|
|
7746
|
|
|
// Fix name and attach hooks |
7747
|
|
|
name = jQuery.propFix[ name ] || name; |
7748
|
|
|
hooks = jQuery.propHooks[ name ]; |
7749
|
|
|
} |
7750
|
|
|
|
7751
|
|
|
if ( value !== undefined ) { |
7752
|
|
|
if ( hooks && "set" in hooks && |
7753
|
|
|
( ret = hooks.set( elem, value, name ) ) !== undefined ) { |
7754
|
|
|
return ret; |
7755
|
|
|
} |
7756
|
|
|
|
7757
|
|
|
return ( elem[ name ] = value ); |
7758
|
|
|
} |
7759
|
|
|
|
7760
|
|
|
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { |
7761
|
|
|
return ret; |
7762
|
|
|
} |
7763
|
|
|
|
7764
|
|
|
return elem[ name ]; |
7765
|
|
|
}, |
7766
|
|
|
|
7767
|
|
|
propHooks: { |
7768
|
|
|
tabIndex: { |
7769
|
|
|
get: function( elem ) { |
7770
|
|
|
|
7771
|
|
|
// Support: IE <=9 - 11 only |
7772
|
|
|
// elem.tabIndex doesn't always return the |
7773
|
|
|
// correct value when it hasn't been explicitly set |
7774
|
|
|
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
7775
|
|
|
// Use proper attribute retrieval(#12072) |
7776
|
|
|
var tabindex = jQuery.find.attr( elem, "tabindex" ); |
7777
|
|
|
|
7778
|
|
|
if ( tabindex ) { |
7779
|
|
|
return parseInt( tabindex, 10 ); |
7780
|
|
|
} |
7781
|
|
|
|
7782
|
|
|
if ( |
7783
|
|
|
rfocusable.test( elem.nodeName ) || |
7784
|
|
|
rclickable.test( elem.nodeName ) && |
7785
|
|
|
elem.href |
7786
|
|
|
) { |
7787
|
|
|
return 0; |
7788
|
|
|
} |
7789
|
|
|
|
7790
|
|
|
return -1; |
7791
|
|
|
} |
7792
|
|
|
} |
7793
|
|
|
}, |
7794
|
|
|
|
7795
|
|
|
propFix: { |
7796
|
|
|
"for": "htmlFor", |
7797
|
|
|
"class": "className" |
7798
|
|
|
} |
7799
|
|
|
} ); |
7800
|
|
|
|
7801
|
|
|
// Support: IE <=11 only |
7802
|
|
|
// Accessing the selectedIndex property |
7803
|
|
|
// forces the browser to respect setting selected |
7804
|
|
|
// on the option |
7805
|
|
|
// The getter ensures a default option is selected |
7806
|
|
|
// when in an optgroup |
7807
|
|
|
// eslint rule "no-unused-expressions" is disabled for this code |
7808
|
|
|
// since it considers such accessions noop |
7809
|
|
|
if ( !support.optSelected ) { |
7810
|
|
|
jQuery.propHooks.selected = { |
7811
|
|
|
get: function( elem ) { |
7812
|
|
|
|
7813
|
|
|
/* eslint no-unused-expressions: "off" */ |
7814
|
|
|
|
7815
|
|
|
var parent = elem.parentNode; |
7816
|
|
|
if ( parent && parent.parentNode ) { |
7817
|
|
|
parent.parentNode.selectedIndex; |
7818
|
|
|
} |
7819
|
|
|
return null; |
7820
|
|
|
}, |
7821
|
|
|
set: function( elem ) { |
7822
|
|
|
|
7823
|
|
|
/* eslint no-unused-expressions: "off" */ |
7824
|
|
|
|
7825
|
|
|
var parent = elem.parentNode; |
7826
|
|
|
if ( parent ) { |
7827
|
|
|
parent.selectedIndex; |
7828
|
|
|
|
7829
|
|
|
if ( parent.parentNode ) { |
7830
|
|
|
parent.parentNode.selectedIndex; |
7831
|
|
|
} |
7832
|
|
|
} |
7833
|
|
|
} |
7834
|
|
|
}; |
7835
|
|
|
} |
7836
|
|
|
|
7837
|
|
|
jQuery.each( [ |
7838
|
|
|
"tabIndex", |
7839
|
|
|
"readOnly", |
7840
|
|
|
"maxLength", |
7841
|
|
|
"cellSpacing", |
7842
|
|
|
"cellPadding", |
7843
|
|
|
"rowSpan", |
7844
|
|
|
"colSpan", |
7845
|
|
|
"useMap", |
7846
|
|
|
"frameBorder", |
7847
|
|
|
"contentEditable" |
7848
|
|
|
], function() { |
7849
|
|
|
jQuery.propFix[ this.toLowerCase() ] = this; |
7850
|
|
|
} ); |
7851
|
|
|
|
7852
|
|
|
|
7853
|
|
|
|
7854
|
|
|
|
7855
|
|
|
// Strip and collapse whitespace according to HTML spec |
7856
|
|
|
// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace |
7857
|
|
|
function stripAndCollapse( value ) { |
7858
|
|
|
var tokens = value.match( rnothtmlwhite ) || []; |
7859
|
|
|
return tokens.join( " " ); |
7860
|
|
|
} |
7861
|
|
|
|
7862
|
|
|
|
7863
|
|
|
function getClass( elem ) { |
7864
|
|
|
return elem.getAttribute && elem.getAttribute( "class" ) || ""; |
7865
|
|
|
} |
7866
|
|
|
|
7867
|
|
|
function classesToArray( value ) { |
7868
|
|
|
if ( Array.isArray( value ) ) { |
7869
|
|
|
return value; |
7870
|
|
|
} |
7871
|
|
|
if ( typeof value === "string" ) { |
7872
|
|
|
return value.match( rnothtmlwhite ) || []; |
7873
|
|
|
} |
7874
|
|
|
return []; |
7875
|
|
|
} |
7876
|
|
|
|
7877
|
|
|
jQuery.fn.extend( { |
7878
|
|
|
addClass: function( value ) { |
7879
|
|
|
var classes, elem, cur, curValue, clazz, j, finalValue, |
7880
|
|
|
i = 0; |
7881
|
|
|
|
7882
|
|
|
if ( isFunction( value ) ) { |
7883
|
|
|
return this.each( function( j ) { |
7884
|
|
|
jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); |
7885
|
|
|
} ); |
7886
|
|
|
} |
7887
|
|
|
|
7888
|
|
|
classes = classesToArray( value ); |
7889
|
|
|
|
7890
|
|
|
if ( classes.length ) { |
7891
|
|
|
while ( ( elem = this[ i++ ] ) ) { |
7892
|
|
|
curValue = getClass( elem ); |
7893
|
|
|
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
7894
|
|
|
|
7895
|
|
|
if ( cur ) { |
7896
|
|
|
j = 0; |
7897
|
|
|
while ( ( clazz = classes[ j++ ] ) ) { |
7898
|
|
|
if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
7899
|
|
|
cur += clazz + " "; |
7900
|
|
|
} |
7901
|
|
|
} |
7902
|
|
|
|
7903
|
|
|
// Only assign if different to avoid unneeded rendering. |
7904
|
|
|
finalValue = stripAndCollapse( cur ); |
7905
|
|
|
if ( curValue !== finalValue ) { |
7906
|
|
|
elem.setAttribute( "class", finalValue ); |
7907
|
|
|
} |
7908
|
|
|
} |
7909
|
|
|
} |
7910
|
|
|
} |
7911
|
|
|
|
7912
|
|
|
return this; |
7913
|
|
|
}, |
7914
|
|
|
|
7915
|
|
|
removeClass: function( value ) { |
7916
|
|
|
var classes, elem, cur, curValue, clazz, j, finalValue, |
7917
|
|
|
i = 0; |
7918
|
|
|
|
7919
|
|
|
if ( isFunction( value ) ) { |
7920
|
|
|
return this.each( function( j ) { |
7921
|
|
|
jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); |
7922
|
|
|
} ); |
7923
|
|
|
} |
7924
|
|
|
|
7925
|
|
|
if ( !arguments.length ) { |
7926
|
|
|
return this.attr( "class", "" ); |
7927
|
|
|
} |
7928
|
|
|
|
7929
|
|
|
classes = classesToArray( value ); |
7930
|
|
|
|
7931
|
|
|
if ( classes.length ) { |
7932
|
|
|
while ( ( elem = this[ i++ ] ) ) { |
7933
|
|
|
curValue = getClass( elem ); |
7934
|
|
|
|
7935
|
|
|
// This expression is here for better compressibility (see addClass) |
7936
|
|
|
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
7937
|
|
|
|
7938
|
|
|
if ( cur ) { |
7939
|
|
|
j = 0; |
7940
|
|
|
while ( ( clazz = classes[ j++ ] ) ) { |
7941
|
|
|
|
7942
|
|
|
// Remove *all* instances |
7943
|
|
|
while ( cur.indexOf( " " + clazz + " " ) > -1 ) { |
7944
|
|
|
cur = cur.replace( " " + clazz + " ", " " ); |
7945
|
|
|
} |
7946
|
|
|
} |
7947
|
|
|
|
7948
|
|
|
// Only assign if different to avoid unneeded rendering. |
7949
|
|
|
finalValue = stripAndCollapse( cur ); |
7950
|
|
|
if ( curValue !== finalValue ) { |
7951
|
|
|
elem.setAttribute( "class", finalValue ); |
7952
|
|
|
} |
7953
|
|
|
} |
7954
|
|
|
} |
7955
|
|
|
} |
7956
|
|
|
|
7957
|
|
|
return this; |
7958
|
|
|
}, |
7959
|
|
|
|
7960
|
|
|
toggleClass: function( value, stateVal ) { |
7961
|
|
|
var type = typeof value, |
7962
|
|
|
isValidValue = type === "string" || Array.isArray( value ); |
7963
|
|
|
|
7964
|
|
|
if ( typeof stateVal === "boolean" && isValidValue ) { |
7965
|
|
|
return stateVal ? this.addClass( value ) : this.removeClass( value ); |
7966
|
|
|
} |
7967
|
|
|
|
7968
|
|
|
if ( isFunction( value ) ) { |
7969
|
|
|
return this.each( function( i ) { |
7970
|
|
|
jQuery( this ).toggleClass( |
7971
|
|
|
value.call( this, i, getClass( this ), stateVal ), |
7972
|
|
|
stateVal |
7973
|
|
|
); |
7974
|
|
|
} ); |
7975
|
|
|
} |
7976
|
|
|
|
7977
|
|
|
return this.each( function() { |
7978
|
|
|
var className, i, self, classNames; |
7979
|
|
|
|
7980
|
|
|
if ( isValidValue ) { |
7981
|
|
|
|
7982
|
|
|
// Toggle individual class names |
7983
|
|
|
i = 0; |
7984
|
|
|
self = jQuery( this ); |
7985
|
|
|
classNames = classesToArray( value ); |
7986
|
|
|
|
7987
|
|
|
while ( ( className = classNames[ i++ ] ) ) { |
7988
|
|
|
|
7989
|
|
|
// Check each className given, space separated list |
7990
|
|
|
if ( self.hasClass( className ) ) { |
7991
|
|
|
self.removeClass( className ); |
7992
|
|
|
} else { |
7993
|
|
|
self.addClass( className ); |
7994
|
|
|
} |
7995
|
|
|
} |
7996
|
|
|
|
7997
|
|
|
// Toggle whole class name |
7998
|
|
|
} else if ( value === undefined || type === "boolean" ) { |
7999
|
|
|
className = getClass( this ); |
8000
|
|
|
if ( className ) { |
8001
|
|
|
|
8002
|
|
|
// Store className if set |
8003
|
|
|
dataPriv.set( this, "__className__", className ); |
8004
|
|
|
} |
8005
|
|
|
|
8006
|
|
|
// If the element has a class name or if we're passed `false`, |
8007
|
|
|
// then remove the whole classname (if there was one, the above saved it). |
8008
|
|
|
// Otherwise bring back whatever was previously saved (if anything), |
8009
|
|
|
// falling back to the empty string if nothing was stored. |
8010
|
|
|
if ( this.setAttribute ) { |
8011
|
|
|
this.setAttribute( "class", |
8012
|
|
|
className || value === false ? |
8013
|
|
|
"" : |
8014
|
|
|
dataPriv.get( this, "__className__" ) || "" |
8015
|
|
|
); |
8016
|
|
|
} |
8017
|
|
|
} |
8018
|
|
|
} ); |
8019
|
|
|
}, |
8020
|
|
|
|
8021
|
|
|
hasClass: function( selector ) { |
8022
|
|
|
var className, elem, |
8023
|
|
|
i = 0; |
8024
|
|
|
|
8025
|
|
|
className = " " + selector + " "; |
8026
|
|
|
while ( ( elem = this[ i++ ] ) ) { |
8027
|
|
|
if ( elem.nodeType === 1 && |
8028
|
|
|
( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { |
8029
|
|
|
return true; |
8030
|
|
|
} |
8031
|
|
|
} |
8032
|
|
|
|
8033
|
|
|
return false; |
8034
|
|
|
} |
8035
|
|
|
} ); |
8036
|
|
|
|
8037
|
|
|
|
8038
|
|
|
|
8039
|
|
|
|
8040
|
|
|
var rreturn = /\r/g; |
8041
|
|
|
|
8042
|
|
|
jQuery.fn.extend( { |
8043
|
|
|
val: function( value ) { |
8044
|
|
|
var hooks, ret, valueIsFunction, |
8045
|
|
|
elem = this[ 0 ]; |
8046
|
|
|
|
8047
|
|
|
if ( !arguments.length ) { |
8048
|
|
|
if ( elem ) { |
8049
|
|
|
hooks = jQuery.valHooks[ elem.type ] || |
8050
|
|
|
jQuery.valHooks[ elem.nodeName.toLowerCase() ]; |
8051
|
|
|
|
8052
|
|
|
if ( hooks && |
8053
|
|
|
"get" in hooks && |
8054
|
|
|
( ret = hooks.get( elem, "value" ) ) !== undefined |
8055
|
|
|
) { |
8056
|
|
|
return ret; |
8057
|
|
|
} |
8058
|
|
|
|
8059
|
|
|
ret = elem.value; |
8060
|
|
|
|
8061
|
|
|
// Handle most common string cases |
8062
|
|
|
if ( typeof ret === "string" ) { |
8063
|
|
|
return ret.replace( rreturn, "" ); |
8064
|
|
|
} |
8065
|
|
|
|
8066
|
|
|
// Handle cases where value is null/undef or number |
8067
|
|
|
return ret == null ? "" : ret; |
8068
|
|
|
} |
8069
|
|
|
|
8070
|
|
|
return; |
8071
|
|
|
} |
8072
|
|
|
|
8073
|
|
|
valueIsFunction = isFunction( value ); |
8074
|
|
|
|
8075
|
|
|
return this.each( function( i ) { |
8076
|
|
|
var val; |
8077
|
|
|
|
8078
|
|
|
if ( this.nodeType !== 1 ) { |
8079
|
|
|
return; |
8080
|
|
|
} |
8081
|
|
|
|
8082
|
|
|
if ( valueIsFunction ) { |
8083
|
|
|
val = value.call( this, i, jQuery( this ).val() ); |
8084
|
|
|
} else { |
8085
|
|
|
val = value; |
8086
|
|
|
} |
8087
|
|
|
|
8088
|
|
|
// Treat null/undefined as ""; convert numbers to string |
8089
|
|
|
if ( val == null ) { |
8090
|
|
|
val = ""; |
8091
|
|
|
|
8092
|
|
|
} else if ( typeof val === "number" ) { |
8093
|
|
|
val += ""; |
8094
|
|
|
|
8095
|
|
|
} else if ( Array.isArray( val ) ) { |
8096
|
|
|
val = jQuery.map( val, function( value ) { |
8097
|
|
|
return value == null ? "" : value + ""; |
8098
|
|
|
} ); |
8099
|
|
|
} |
8100
|
|
|
|
8101
|
|
|
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; |
8102
|
|
|
|
8103
|
|
|
// If set returns undefined, fall back to normal setting |
8104
|
|
|
if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { |
8105
|
|
|
this.value = val; |
8106
|
|
|
} |
8107
|
|
|
} ); |
8108
|
|
|
} |
8109
|
|
|
} ); |
8110
|
|
|
|
8111
|
|
|
jQuery.extend( { |
8112
|
|
|
valHooks: { |
8113
|
|
|
option: { |
8114
|
|
|
get: function( elem ) { |
8115
|
|
|
|
8116
|
|
|
var val = jQuery.find.attr( elem, "value" ); |
8117
|
|
|
return val != null ? |
8118
|
|
|
val : |
8119
|
|
|
|
8120
|
|
|
// Support: IE <=10 - 11 only |
8121
|
|
|
// option.text throws exceptions (#14686, #14858) |
8122
|
|
|
// Strip and collapse whitespace |
8123
|
|
|
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace |
8124
|
|
|
stripAndCollapse( jQuery.text( elem ) ); |
8125
|
|
|
} |
8126
|
|
|
}, |
8127
|
|
|
select: { |
8128
|
|
|
get: function( elem ) { |
8129
|
|
|
var value, option, i, |
8130
|
|
|
options = elem.options, |
8131
|
|
|
index = elem.selectedIndex, |
8132
|
|
|
one = elem.type === "select-one", |
8133
|
|
|
values = one ? null : [], |
8134
|
|
|
max = one ? index + 1 : options.length; |
8135
|
|
|
|
8136
|
|
|
if ( index < 0 ) { |
8137
|
|
|
i = max; |
8138
|
|
|
|
8139
|
|
|
} else { |
8140
|
|
|
i = one ? index : 0; |
8141
|
|
|
} |
8142
|
|
|
|
8143
|
|
|
// Loop through all the selected options |
8144
|
|
|
for ( ; i < max; i++ ) { |
8145
|
|
|
option = options[ i ]; |
8146
|
|
|
|
8147
|
|
|
// Support: IE <=9 only |
8148
|
|
|
// IE8-9 doesn't update selected after form reset (#2551) |
8149
|
|
|
if ( ( option.selected || i === index ) && |
8150
|
|
|
|
8151
|
|
|
// Don't return options that are disabled or in a disabled optgroup |
8152
|
|
|
!option.disabled && |
8153
|
|
|
( !option.parentNode.disabled || |
8154
|
|
|
!nodeName( option.parentNode, "optgroup" ) ) ) { |
8155
|
|
|
|
8156
|
|
|
// Get the specific value for the option |
8157
|
|
|
value = jQuery( option ).val(); |
8158
|
|
|
|
8159
|
|
|
// We don't need an array for one selects |
8160
|
|
|
if ( one ) { |
8161
|
|
|
return value; |
8162
|
|
|
} |
8163
|
|
|
|
8164
|
|
|
// Multi-Selects return an array |
8165
|
|
|
values.push( value ); |
8166
|
|
|
} |
8167
|
|
|
} |
8168
|
|
|
|
8169
|
|
|
return values; |
8170
|
|
|
}, |
8171
|
|
|
|
8172
|
|
|
set: function( elem, value ) { |
8173
|
|
|
var optionSet, option, |
8174
|
|
|
options = elem.options, |
8175
|
|
|
values = jQuery.makeArray( value ), |
8176
|
|
|
i = options.length; |
8177
|
|
|
|
8178
|
|
|
while ( i-- ) { |
8179
|
|
|
option = options[ i ]; |
8180
|
|
|
|
8181
|
|
|
/* eslint-disable no-cond-assign */ |
8182
|
|
|
|
8183
|
|
|
if ( option.selected = |
8184
|
|
|
jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 |
8185
|
|
|
) { |
8186
|
|
|
optionSet = true; |
8187
|
|
|
} |
8188
|
|
|
|
8189
|
|
|
/* eslint-enable no-cond-assign */ |
8190
|
|
|
} |
8191
|
|
|
|
8192
|
|
|
// Force browsers to behave consistently when non-matching value is set |
8193
|
|
|
if ( !optionSet ) { |
8194
|
|
|
elem.selectedIndex = -1; |
8195
|
|
|
} |
8196
|
|
|
return values; |
8197
|
|
|
} |
8198
|
|
|
} |
8199
|
|
|
} |
8200
|
|
|
} ); |
8201
|
|
|
|
8202
|
|
|
// Radios and checkboxes getter/setter |
8203
|
|
|
jQuery.each( [ "radio", "checkbox" ], function() { |
8204
|
|
|
jQuery.valHooks[ this ] = { |
8205
|
|
|
set: function( elem, value ) { |
8206
|
|
|
if ( Array.isArray( value ) ) { |
8207
|
|
|
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); |
8208
|
|
|
} |
8209
|
|
|
} |
8210
|
|
|
}; |
8211
|
|
|
if ( !support.checkOn ) { |
8212
|
|
|
jQuery.valHooks[ this ].get = function( elem ) { |
8213
|
|
|
return elem.getAttribute( "value" ) === null ? "on" : elem.value; |
8214
|
|
|
}; |
8215
|
|
|
} |
8216
|
|
|
} ); |
8217
|
|
|
|
8218
|
|
|
|
8219
|
|
|
|
8220
|
|
|
|
8221
|
|
|
// Return jQuery for attributes-only inclusion |
8222
|
|
|
|
8223
|
|
|
|
8224
|
|
|
support.focusin = "onfocusin" in window; |
8225
|
|
|
|
8226
|
|
|
|
8227
|
|
|
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, |
8228
|
|
|
stopPropagationCallback = function( e ) { |
8229
|
|
|
e.stopPropagation(); |
8230
|
|
|
}; |
8231
|
|
|
|
8232
|
|
|
jQuery.extend( jQuery.event, { |
8233
|
|
|
|
8234
|
|
|
trigger: function( event, data, elem, onlyHandlers ) { |
8235
|
|
|
|
8236
|
|
|
var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, |
8237
|
|
|
eventPath = [ elem || document ], |
8238
|
|
|
type = hasOwn.call( event, "type" ) ? event.type : event, |
8239
|
|
|
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; |
8240
|
|
|
|
8241
|
|
|
cur = lastElement = tmp = elem = elem || document; |
8242
|
|
|
|
8243
|
|
|
// Don't do events on text and comment nodes |
8244
|
|
|
if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
8245
|
|
|
return; |
8246
|
|
|
} |
8247
|
|
|
|
8248
|
|
|
// focus/blur morphs to focusin/out; ensure we're not firing them right now |
8249
|
|
|
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { |
8250
|
|
|
return; |
8251
|
|
|
} |
8252
|
|
|
|
8253
|
|
|
if ( type.indexOf( "." ) > -1 ) { |
8254
|
|
|
|
8255
|
|
|
// Namespaced trigger; create a regexp to match event type in handle() |
8256
|
|
|
namespaces = type.split( "." ); |
8257
|
|
|
type = namespaces.shift(); |
8258
|
|
|
namespaces.sort(); |
8259
|
|
|
} |
8260
|
|
|
ontype = type.indexOf( ":" ) < 0 && "on" + type; |
8261
|
|
|
|
8262
|
|
|
// Caller can pass in a jQuery.Event object, Object, or just an event type string |
8263
|
|
|
event = event[ jQuery.expando ] ? |
8264
|
|
|
event : |
8265
|
|
|
new jQuery.Event( type, typeof event === "object" && event ); |
8266
|
|
|
|
8267
|
|
|
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) |
8268
|
|
|
event.isTrigger = onlyHandlers ? 2 : 3; |
8269
|
|
|
event.namespace = namespaces.join( "." ); |
8270
|
|
|
event.rnamespace = event.namespace ? |
8271
|
|
|
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : |
8272
|
|
|
null; |
8273
|
|
|
|
8274
|
|
|
// Clean up the event in case it is being reused |
8275
|
|
|
event.result = undefined; |
8276
|
|
|
if ( !event.target ) { |
8277
|
|
|
event.target = elem; |
8278
|
|
|
} |
8279
|
|
|
|
8280
|
|
|
// Clone any incoming data and prepend the event, creating the handler arg list |
8281
|
|
|
data = data == null ? |
8282
|
|
|
[ event ] : |
8283
|
|
|
jQuery.makeArray( data, [ event ] ); |
8284
|
|
|
|
8285
|
|
|
// Allow special events to draw outside the lines |
8286
|
|
|
special = jQuery.event.special[ type ] || {}; |
8287
|
|
|
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { |
8288
|
|
|
return; |
8289
|
|
|
} |
8290
|
|
|
|
8291
|
|
|
// Determine event propagation path in advance, per W3C events spec (#9951) |
8292
|
|
|
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724) |
8293
|
|
|
if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { |
8294
|
|
|
|
8295
|
|
|
bubbleType = special.delegateType || type; |
8296
|
|
|
if ( !rfocusMorph.test( bubbleType + type ) ) { |
8297
|
|
|
cur = cur.parentNode; |
8298
|
|
|
} |
8299
|
|
|
for ( ; cur; cur = cur.parentNode ) { |
8300
|
|
|
eventPath.push( cur ); |
8301
|
|
|
tmp = cur; |
8302
|
|
|
} |
8303
|
|
|
|
8304
|
|
|
// Only add window if we got to document (e.g., not plain obj or detached DOM) |
8305
|
|
|
if ( tmp === ( elem.ownerDocument || document ) ) { |
8306
|
|
|
eventPath.push( tmp.defaultView || tmp.parentWindow || window ); |
8307
|
|
|
} |
8308
|
|
|
} |
8309
|
|
|
|
8310
|
|
|
// Fire handlers on the event path |
8311
|
|
|
i = 0; |
8312
|
|
|
while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { |
8313
|
|
|
lastElement = cur; |
8314
|
|
|
event.type = i > 1 ? |
8315
|
|
|
bubbleType : |
8316
|
|
|
special.bindType || type; |
8317
|
|
|
|
8318
|
|
|
// jQuery handler |
8319
|
|
|
handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && |
8320
|
|
|
dataPriv.get( cur, "handle" ); |
8321
|
|
|
if ( handle ) { |
8322
|
|
|
handle.apply( cur, data ); |
8323
|
|
|
} |
8324
|
|
|
|
8325
|
|
|
// Native handler |
8326
|
|
|
handle = ontype && cur[ ontype ]; |
8327
|
|
|
if ( handle && handle.apply && acceptData( cur ) ) { |
8328
|
|
|
event.result = handle.apply( cur, data ); |
8329
|
|
|
if ( event.result === false ) { |
8330
|
|
|
event.preventDefault(); |
8331
|
|
|
} |
8332
|
|
|
} |
8333
|
|
|
} |
8334
|
|
|
event.type = type; |
8335
|
|
|
|
8336
|
|
|
// If nobody prevented the default action, do it now |
8337
|
|
|
if ( !onlyHandlers && !event.isDefaultPrevented() ) { |
8338
|
|
|
|
8339
|
|
|
if ( ( !special._default || |
8340
|
|
|
special._default.apply( eventPath.pop(), data ) === false ) && |
8341
|
|
|
acceptData( elem ) ) { |
8342
|
|
|
|
8343
|
|
|
// Call a native DOM method on the target with the same name as the event. |
8344
|
|
|
// Don't do default actions on window, that's where global variables be (#6170) |
8345
|
|
|
if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { |
8346
|
|
|
|
8347
|
|
|
// Don't re-trigger an onFOO event when we call its FOO() method |
8348
|
|
|
tmp = elem[ ontype ]; |
8349
|
|
|
|
8350
|
|
|
if ( tmp ) { |
8351
|
|
|
elem[ ontype ] = null; |
8352
|
|
|
} |
8353
|
|
|
|
8354
|
|
|
// Prevent re-triggering of the same event, since we already bubbled it above |
8355
|
|
|
jQuery.event.triggered = type; |
8356
|
|
|
|
8357
|
|
|
if ( event.isPropagationStopped() ) { |
8358
|
|
|
lastElement.addEventListener( type, stopPropagationCallback ); |
8359
|
|
|
} |
8360
|
|
|
|
8361
|
|
|
elem[ type ](); |
8362
|
|
|
|
8363
|
|
|
if ( event.isPropagationStopped() ) { |
8364
|
|
|
lastElement.removeEventListener( type, stopPropagationCallback ); |
8365
|
|
|
} |
8366
|
|
|
|
8367
|
|
|
jQuery.event.triggered = undefined; |
8368
|
|
|
|
8369
|
|
|
if ( tmp ) { |
8370
|
|
|
elem[ ontype ] = tmp; |
8371
|
|
|
} |
8372
|
|
|
} |
8373
|
|
|
} |
8374
|
|
|
} |
8375
|
|
|
|
8376
|
|
|
return event.result; |
8377
|
|
|
}, |
8378
|
|
|
|
8379
|
|
|
// Piggyback on a donor event to simulate a different one |
8380
|
|
|
// Used only for `focus(in | out)` events |
8381
|
|
|
simulate: function( type, elem, event ) { |
8382
|
|
|
var e = jQuery.extend( |
8383
|
|
|
new jQuery.Event(), |
8384
|
|
|
event, |
8385
|
|
|
{ |
8386
|
|
|
type: type, |
8387
|
|
|
isSimulated: true |
8388
|
|
|
} |
8389
|
|
|
); |
8390
|
|
|
|
8391
|
|
|
jQuery.event.trigger( e, null, elem ); |
8392
|
|
|
} |
8393
|
|
|
|
8394
|
|
|
} ); |
8395
|
|
|
|
8396
|
|
|
jQuery.fn.extend( { |
8397
|
|
|
|
8398
|
|
|
trigger: function( type, data ) { |
8399
|
|
|
return this.each( function() { |
8400
|
|
|
jQuery.event.trigger( type, data, this ); |
8401
|
|
|
} ); |
8402
|
|
|
}, |
8403
|
|
|
triggerHandler: function( type, data ) { |
8404
|
|
|
var elem = this[ 0 ]; |
8405
|
|
|
if ( elem ) { |
8406
|
|
|
return jQuery.event.trigger( type, data, elem, true ); |
8407
|
|
|
} |
8408
|
|
|
} |
8409
|
|
|
} ); |
8410
|
|
|
|
8411
|
|
|
|
8412
|
|
|
// Support: Firefox <=44 |
8413
|
|
|
// Firefox doesn't have focus(in | out) events |
8414
|
|
|
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 |
8415
|
|
|
// |
8416
|
|
|
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 |
8417
|
|
|
// focus(in | out) events fire after focus & blur events, |
8418
|
|
|
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order |
8419
|
|
|
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 |
8420
|
|
|
if ( !support.focusin ) { |
8421
|
|
|
jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
8422
|
|
|
|
8423
|
|
|
// Attach a single capturing handler on the document while someone wants focusin/focusout |
8424
|
|
|
var handler = function( event ) { |
8425
|
|
|
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); |
8426
|
|
|
}; |
8427
|
|
|
|
8428
|
|
|
jQuery.event.special[ fix ] = { |
8429
|
|
|
setup: function() { |
8430
|
|
|
var doc = this.ownerDocument || this, |
8431
|
|
|
attaches = dataPriv.access( doc, fix ); |
8432
|
|
|
|
8433
|
|
|
if ( !attaches ) { |
8434
|
|
|
doc.addEventListener( orig, handler, true ); |
8435
|
|
|
} |
8436
|
|
|
dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); |
8437
|
|
|
}, |
8438
|
|
|
teardown: function() { |
8439
|
|
|
var doc = this.ownerDocument || this, |
8440
|
|
|
attaches = dataPriv.access( doc, fix ) - 1; |
8441
|
|
|
|
8442
|
|
|
if ( !attaches ) { |
8443
|
|
|
doc.removeEventListener( orig, handler, true ); |
8444
|
|
|
dataPriv.remove( doc, fix ); |
8445
|
|
|
|
8446
|
|
|
} else { |
8447
|
|
|
dataPriv.access( doc, fix, attaches ); |
8448
|
|
|
} |
8449
|
|
|
} |
8450
|
|
|
}; |
8451
|
|
|
} ); |
8452
|
|
|
} |
8453
|
|
|
var location = window.location; |
8454
|
|
|
|
8455
|
|
|
var nonce = Date.now(); |
8456
|
|
|
|
8457
|
|
|
var rquery = ( /\?/ ); |
8458
|
|
|
|
8459
|
|
|
|
8460
|
|
|
|
8461
|
|
|
// Cross-browser xml parsing |
8462
|
|
|
jQuery.parseXML = function( data ) { |
8463
|
|
|
var xml; |
8464
|
|
|
if ( !data || typeof data !== "string" ) { |
8465
|
|
|
return null; |
8466
|
|
|
} |
8467
|
|
|
|
8468
|
|
|
// Support: IE 9 - 11 only |
8469
|
|
|
// IE throws on parseFromString with invalid input. |
8470
|
|
|
try { |
8471
|
|
|
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); |
8472
|
|
|
} catch ( e ) { |
8473
|
|
|
xml = undefined; |
8474
|
|
|
} |
8475
|
|
|
|
8476
|
|
|
if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { |
8477
|
|
|
jQuery.error( "Invalid XML: " + data ); |
8478
|
|
|
} |
8479
|
|
|
return xml; |
8480
|
|
|
}; |
8481
|
|
|
|
8482
|
|
|
|
8483
|
|
|
var |
8484
|
|
|
rbracket = /\[\]$/, |
8485
|
|
|
rCRLF = /\r?\n/g, |
8486
|
|
|
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
8487
|
|
|
rsubmittable = /^(?:input|select|textarea|keygen)/i; |
8488
|
|
|
|
8489
|
|
|
function buildParams( prefix, obj, traditional, add ) { |
8490
|
|
|
var name; |
8491
|
|
|
|
8492
|
|
|
if ( Array.isArray( obj ) ) { |
8493
|
|
|
|
8494
|
|
|
// Serialize array item. |
8495
|
|
|
jQuery.each( obj, function( i, v ) { |
8496
|
|
|
if ( traditional || rbracket.test( prefix ) ) { |
8497
|
|
|
|
8498
|
|
|
// Treat each array item as a scalar. |
8499
|
|
|
add( prefix, v ); |
8500
|
|
|
|
8501
|
|
|
} else { |
8502
|
|
|
|
8503
|
|
|
// Item is non-scalar (array or object), encode its numeric index. |
8504
|
|
|
buildParams( |
8505
|
|
|
prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", |
8506
|
|
|
v, |
8507
|
|
|
traditional, |
8508
|
|
|
add |
8509
|
|
|
); |
8510
|
|
|
} |
8511
|
|
|
} ); |
8512
|
|
|
|
8513
|
|
|
} else if ( !traditional && toType( obj ) === "object" ) { |
8514
|
|
|
|
8515
|
|
|
// Serialize object item. |
8516
|
|
|
for ( name in obj ) { |
8517
|
|
|
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); |
8518
|
|
|
} |
8519
|
|
|
|
8520
|
|
|
} else { |
8521
|
|
|
|
8522
|
|
|
// Serialize scalar item. |
8523
|
|
|
add( prefix, obj ); |
8524
|
|
|
} |
8525
|
|
|
} |
8526
|
|
|
|
8527
|
|
|
// Serialize an array of form elements or a set of |
8528
|
|
|
// key/values into a query string |
8529
|
|
|
jQuery.param = function( a, traditional ) { |
8530
|
|
|
var prefix, |
8531
|
|
|
s = [], |
8532
|
|
|
add = function( key, valueOrFunction ) { |
8533
|
|
|
|
8534
|
|
|
// If value is a function, invoke it and use its return value |
8535
|
|
|
var value = isFunction( valueOrFunction ) ? |
8536
|
|
|
valueOrFunction() : |
8537
|
|
|
valueOrFunction; |
8538
|
|
|
|
8539
|
|
|
s[ s.length ] = encodeURIComponent( key ) + "=" + |
8540
|
|
|
encodeURIComponent( value == null ? "" : value ); |
8541
|
|
|
}; |
8542
|
|
|
|
8543
|
|
|
// If an array was passed in, assume that it is an array of form elements. |
8544
|
|
|
if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { |
8545
|
|
|
|
8546
|
|
|
// Serialize the form elements |
8547
|
|
|
jQuery.each( a, function() { |
8548
|
|
|
add( this.name, this.value ); |
8549
|
|
|
} ); |
8550
|
|
|
|
8551
|
|
|
} else { |
8552
|
|
|
|
8553
|
|
|
// If traditional, encode the "old" way (the way 1.3.2 or older |
8554
|
|
|
// did it), otherwise encode params recursively. |
8555
|
|
|
for ( prefix in a ) { |
8556
|
|
|
buildParams( prefix, a[ prefix ], traditional, add ); |
8557
|
|
|
} |
8558
|
|
|
} |
8559
|
|
|
|
8560
|
|
|
// Return the resulting serialization |
8561
|
|
|
return s.join( "&" ); |
8562
|
|
|
}; |
8563
|
|
|
|
8564
|
|
|
jQuery.fn.extend( { |
8565
|
|
|
serialize: function() { |
8566
|
|
|
return jQuery.param( this.serializeArray() ); |
8567
|
|
|
}, |
8568
|
|
|
serializeArray: function() { |
8569
|
|
|
return this.map( function() { |
8570
|
|
|
|
8571
|
|
|
// Can add propHook for "elements" to filter or add form elements |
8572
|
|
|
var elements = jQuery.prop( this, "elements" ); |
8573
|
|
|
return elements ? jQuery.makeArray( elements ) : this; |
8574
|
|
|
} ) |
8575
|
|
|
.filter( function() { |
8576
|
|
|
var type = this.type; |
8577
|
|
|
|
8578
|
|
|
// Use .is( ":disabled" ) so that fieldset[disabled] works |
8579
|
|
|
return this.name && !jQuery( this ).is( ":disabled" ) && |
8580
|
|
|
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && |
8581
|
|
|
( this.checked || !rcheckableType.test( type ) ); |
8582
|
|
|
} ) |
8583
|
|
|
.map( function( i, elem ) { |
8584
|
|
|
var val = jQuery( this ).val(); |
8585
|
|
|
|
8586
|
|
|
if ( val == null ) { |
8587
|
|
|
return null; |
8588
|
|
|
} |
8589
|
|
|
|
8590
|
|
|
if ( Array.isArray( val ) ) { |
8591
|
|
|
return jQuery.map( val, function( val ) { |
8592
|
|
|
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
8593
|
|
|
} ); |
8594
|
|
|
} |
8595
|
|
|
|
8596
|
|
|
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
8597
|
|
|
} ).get(); |
8598
|
|
|
} |
8599
|
|
|
} ); |
8600
|
|
|
|
8601
|
|
|
|
8602
|
|
|
var |
8603
|
|
|
r20 = /%20/g, |
8604
|
|
|
rhash = /#.*$/, |
8605
|
|
|
rantiCache = /([?&])_=[^&]*/, |
8606
|
|
|
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, |
8607
|
|
|
|
8608
|
|
|
// #7653, #8125, #8152: local protocol detection |
8609
|
|
|
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, |
8610
|
|
|
rnoContent = /^(?:GET|HEAD)$/, |
8611
|
|
|
rprotocol = /^\/\//, |
8612
|
|
|
|
8613
|
|
|
/* Prefilters |
8614
|
|
|
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) |
8615
|
|
|
* 2) These are called: |
8616
|
|
|
* - BEFORE asking for a transport |
8617
|
|
|
* - AFTER param serialization (s.data is a string if s.processData is true) |
8618
|
|
|
* 3) key is the dataType |
8619
|
|
|
* 4) the catchall symbol "*" can be used |
8620
|
|
|
* 5) execution will start with transport dataType and THEN continue down to "*" if needed |
8621
|
|
|
*/ |
8622
|
|
|
prefilters = {}, |
8623
|
|
|
|
8624
|
|
|
/* Transports bindings |
8625
|
|
|
* 1) key is the dataType |
8626
|
|
|
* 2) the catchall symbol "*" can be used |
8627
|
|
|
* 3) selection will start with transport dataType and THEN go to "*" if needed |
8628
|
|
|
*/ |
8629
|
|
|
transports = {}, |
8630
|
|
|
|
8631
|
|
|
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression |
8632
|
|
|
allTypes = "*/".concat( "*" ), |
8633
|
|
|
|
8634
|
|
|
// Anchor tag for parsing the document origin |
8635
|
|
|
originAnchor = document.createElement( "a" ); |
8636
|
|
|
originAnchor.href = location.href; |
8637
|
|
|
|
8638
|
|
|
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport |
8639
|
|
|
function addToPrefiltersOrTransports( structure ) { |
8640
|
|
|
|
8641
|
|
|
// dataTypeExpression is optional and defaults to "*" |
8642
|
|
|
return function( dataTypeExpression, func ) { |
8643
|
|
|
|
8644
|
|
|
if ( typeof dataTypeExpression !== "string" ) { |
8645
|
|
|
func = dataTypeExpression; |
8646
|
|
|
dataTypeExpression = "*"; |
8647
|
|
|
} |
8648
|
|
|
|
8649
|
|
|
var dataType, |
8650
|
|
|
i = 0, |
8651
|
|
|
dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; |
8652
|
|
|
|
8653
|
|
|
if ( isFunction( func ) ) { |
8654
|
|
|
|
8655
|
|
|
// For each dataType in the dataTypeExpression |
8656
|
|
|
while ( ( dataType = dataTypes[ i++ ] ) ) { |
8657
|
|
|
|
8658
|
|
|
// Prepend if requested |
8659
|
|
|
if ( dataType[ 0 ] === "+" ) { |
8660
|
|
|
dataType = dataType.slice( 1 ) || "*"; |
8661
|
|
|
( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); |
8662
|
|
|
|
8663
|
|
|
// Otherwise append |
8664
|
|
|
} else { |
8665
|
|
|
( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); |
8666
|
|
|
} |
8667
|
|
|
} |
8668
|
|
|
} |
8669
|
|
|
}; |
8670
|
|
|
} |
8671
|
|
|
|
8672
|
|
|
// Base inspection function for prefilters and transports |
8673
|
|
|
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { |
8674
|
|
|
|
8675
|
|
|
var inspected = {}, |
8676
|
|
|
seekingTransport = ( structure === transports ); |
8677
|
|
|
|
8678
|
|
|
function inspect( dataType ) { |
8679
|
|
|
var selected; |
8680
|
|
|
inspected[ dataType ] = true; |
8681
|
|
|
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { |
8682
|
|
|
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); |
8683
|
|
|
if ( typeof dataTypeOrTransport === "string" && |
8684
|
|
|
!seekingTransport && !inspected[ dataTypeOrTransport ] ) { |
8685
|
|
|
|
8686
|
|
|
options.dataTypes.unshift( dataTypeOrTransport ); |
8687
|
|
|
inspect( dataTypeOrTransport ); |
8688
|
|
|
return false; |
8689
|
|
|
} else if ( seekingTransport ) { |
8690
|
|
|
return !( selected = dataTypeOrTransport ); |
8691
|
|
|
} |
8692
|
|
|
} ); |
8693
|
|
|
return selected; |
8694
|
|
|
} |
8695
|
|
|
|
8696
|
|
|
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); |
8697
|
|
|
} |
8698
|
|
|
|
8699
|
|
|
// A special extend for ajax options |
8700
|
|
|
// that takes "flat" options (not to be deep extended) |
8701
|
|
|
// Fixes #9887 |
8702
|
|
|
function ajaxExtend( target, src ) { |
8703
|
|
|
var key, deep, |
8704
|
|
|
flatOptions = jQuery.ajaxSettings.flatOptions || {}; |
8705
|
|
|
|
8706
|
|
|
for ( key in src ) { |
8707
|
|
|
if ( src[ key ] !== undefined ) { |
8708
|
|
|
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; |
8709
|
|
|
} |
8710
|
|
|
} |
8711
|
|
|
if ( deep ) { |
8712
|
|
|
jQuery.extend( true, target, deep ); |
8713
|
|
|
} |
8714
|
|
|
|
8715
|
|
|
return target; |
8716
|
|
|
} |
8717
|
|
|
|
8718
|
|
|
/* Handles responses to an ajax request: |
8719
|
|
|
* - finds the right dataType (mediates between content-type and expected dataType) |
8720
|
|
|
* - returns the corresponding response |
8721
|
|
|
*/ |
8722
|
|
|
function ajaxHandleResponses( s, jqXHR, responses ) { |
8723
|
|
|
|
8724
|
|
|
var ct, type, finalDataType, firstDataType, |
8725
|
|
|
contents = s.contents, |
8726
|
|
|
dataTypes = s.dataTypes; |
8727
|
|
|
|
8728
|
|
|
// Remove auto dataType and get content-type in the process |
8729
|
|
|
while ( dataTypes[ 0 ] === "*" ) { |
8730
|
|
|
dataTypes.shift(); |
8731
|
|
|
if ( ct === undefined ) { |
8732
|
|
|
ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); |
8733
|
|
|
} |
8734
|
|
|
} |
8735
|
|
|
|
8736
|
|
|
// Check if we're dealing with a known content-type |
8737
|
|
|
if ( ct ) { |
8738
|
|
|
for ( type in contents ) { |
8739
|
|
|
if ( contents[ type ] && contents[ type ].test( ct ) ) { |
8740
|
|
|
dataTypes.unshift( type ); |
8741
|
|
|
break; |
8742
|
|
|
} |
8743
|
|
|
} |
8744
|
|
|
} |
8745
|
|
|
|
8746
|
|
|
// Check to see if we have a response for the expected dataType |
8747
|
|
|
if ( dataTypes[ 0 ] in responses ) { |
8748
|
|
|
finalDataType = dataTypes[ 0 ]; |
8749
|
|
|
} else { |
8750
|
|
|
|
8751
|
|
|
// Try convertible dataTypes |
8752
|
|
|
for ( type in responses ) { |
8753
|
|
|
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { |
8754
|
|
|
finalDataType = type; |
8755
|
|
|
break; |
8756
|
|
|
} |
8757
|
|
|
if ( !firstDataType ) { |
8758
|
|
|
firstDataType = type; |
8759
|
|
|
} |
8760
|
|
|
} |
8761
|
|
|
|
8762
|
|
|
// Or just use first one |
8763
|
|
|
finalDataType = finalDataType || firstDataType; |
8764
|
|
|
} |
8765
|
|
|
|
8766
|
|
|
// If we found a dataType |
8767
|
|
|
// We add the dataType to the list if needed |
8768
|
|
|
// and return the corresponding response |
8769
|
|
|
if ( finalDataType ) { |
8770
|
|
|
if ( finalDataType !== dataTypes[ 0 ] ) { |
8771
|
|
|
dataTypes.unshift( finalDataType ); |
8772
|
|
|
} |
8773
|
|
|
return responses[ finalDataType ]; |
8774
|
|
|
} |
8775
|
|
|
} |
8776
|
|
|
|
8777
|
|
|
/* Chain conversions given the request and the original response |
8778
|
|
|
* Also sets the responseXXX fields on the jqXHR instance |
8779
|
|
|
*/ |
8780
|
|
|
function ajaxConvert( s, response, jqXHR, isSuccess ) { |
8781
|
|
|
var conv2, current, conv, tmp, prev, |
8782
|
|
|
converters = {}, |
8783
|
|
|
|
8784
|
|
|
// Work with a copy of dataTypes in case we need to modify it for conversion |
8785
|
|
|
dataTypes = s.dataTypes.slice(); |
8786
|
|
|
|
8787
|
|
|
// Create converters map with lowercased keys |
8788
|
|
|
if ( dataTypes[ 1 ] ) { |
8789
|
|
|
for ( conv in s.converters ) { |
8790
|
|
|
converters[ conv.toLowerCase() ] = s.converters[ conv ]; |
8791
|
|
|
} |
8792
|
|
|
} |
8793
|
|
|
|
8794
|
|
|
current = dataTypes.shift(); |
8795
|
|
|
|
8796
|
|
|
// Convert to each sequential dataType |
8797
|
|
|
while ( current ) { |
8798
|
|
|
|
8799
|
|
|
if ( s.responseFields[ current ] ) { |
8800
|
|
|
jqXHR[ s.responseFields[ current ] ] = response; |
8801
|
|
|
} |
8802
|
|
|
|
8803
|
|
|
// Apply the dataFilter if provided |
8804
|
|
|
if ( !prev && isSuccess && s.dataFilter ) { |
8805
|
|
|
response = s.dataFilter( response, s.dataType ); |
8806
|
|
|
} |
8807
|
|
|
|
8808
|
|
|
prev = current; |
8809
|
|
|
current = dataTypes.shift(); |
8810
|
|
|
|
8811
|
|
|
if ( current ) { |
8812
|
|
|
|
8813
|
|
|
// There's only work to do if current dataType is non-auto |
8814
|
|
|
if ( current === "*" ) { |
8815
|
|
|
|
8816
|
|
|
current = prev; |
8817
|
|
|
|
8818
|
|
|
// Convert response if prev dataType is non-auto and differs from current |
8819
|
|
|
} else if ( prev !== "*" && prev !== current ) { |
8820
|
|
|
|
8821
|
|
|
// Seek a direct converter |
8822
|
|
|
conv = converters[ prev + " " + current ] || converters[ "* " + current ]; |
8823
|
|
|
|
8824
|
|
|
// If none found, seek a pair |
8825
|
|
|
if ( !conv ) { |
8826
|
|
|
for ( conv2 in converters ) { |
8827
|
|
|
|
8828
|
|
|
// If conv2 outputs current |
8829
|
|
|
tmp = conv2.split( " " ); |
8830
|
|
|
if ( tmp[ 1 ] === current ) { |
8831
|
|
|
|
8832
|
|
|
// If prev can be converted to accepted input |
8833
|
|
|
conv = converters[ prev + " " + tmp[ 0 ] ] || |
8834
|
|
|
converters[ "* " + tmp[ 0 ] ]; |
8835
|
|
|
if ( conv ) { |
8836
|
|
|
|
8837
|
|
|
// Condense equivalence converters |
8838
|
|
|
if ( conv === true ) { |
8839
|
|
|
conv = converters[ conv2 ]; |
8840
|
|
|
|
8841
|
|
|
// Otherwise, insert the intermediate dataType |
8842
|
|
|
} else if ( converters[ conv2 ] !== true ) { |
8843
|
|
|
current = tmp[ 0 ]; |
8844
|
|
|
dataTypes.unshift( tmp[ 1 ] ); |
8845
|
|
|
} |
8846
|
|
|
break; |
8847
|
|
|
} |
8848
|
|
|
} |
8849
|
|
|
} |
8850
|
|
|
} |
8851
|
|
|
|
8852
|
|
|
// Apply converter (if not an equivalence) |
8853
|
|
|
if ( conv !== true ) { |
8854
|
|
|
|
8855
|
|
|
// Unless errors are allowed to bubble, catch and return them |
8856
|
|
|
if ( conv && s.throws ) { |
8857
|
|
|
response = conv( response ); |
8858
|
|
|
} else { |
8859
|
|
|
try { |
8860
|
|
|
response = conv( response ); |
8861
|
|
|
} catch ( e ) { |
8862
|
|
|
return { |
8863
|
|
|
state: "parsererror", |
8864
|
|
|
error: conv ? e : "No conversion from " + prev + " to " + current |
8865
|
|
|
}; |
8866
|
|
|
} |
8867
|
|
|
} |
8868
|
|
|
} |
8869
|
|
|
} |
8870
|
|
|
} |
8871
|
|
|
} |
8872
|
|
|
|
8873
|
|
|
return { state: "success", data: response }; |
8874
|
|
|
} |
8875
|
|
|
|
8876
|
|
|
jQuery.extend( { |
8877
|
|
|
|
8878
|
|
|
// Counter for holding the number of active queries |
8879
|
|
|
active: 0, |
8880
|
|
|
|
8881
|
|
|
// Last-Modified header cache for next request |
8882
|
|
|
lastModified: {}, |
8883
|
|
|
etag: {}, |
8884
|
|
|
|
8885
|
|
|
ajaxSettings: { |
8886
|
|
|
url: location.href, |
8887
|
|
|
type: "GET", |
8888
|
|
|
isLocal: rlocalProtocol.test( location.protocol ), |
8889
|
|
|
global: true, |
8890
|
|
|
processData: true, |
8891
|
|
|
async: true, |
8892
|
|
|
contentType: "application/x-www-form-urlencoded; charset=UTF-8", |
8893
|
|
|
|
8894
|
|
|
/* |
8895
|
|
|
timeout: 0, |
8896
|
|
|
data: null, |
8897
|
|
|
dataType: null, |
8898
|
|
|
username: null, |
8899
|
|
|
password: null, |
8900
|
|
|
cache: null, |
8901
|
|
|
throws: false, |
8902
|
|
|
traditional: false, |
8903
|
|
|
headers: {}, |
8904
|
|
|
*/ |
8905
|
|
|
|
8906
|
|
|
accepts: { |
8907
|
|
|
"*": allTypes, |
8908
|
|
|
text: "text/plain", |
8909
|
|
|
html: "text/html", |
8910
|
|
|
xml: "application/xml, text/xml", |
8911
|
|
|
json: "application/json, text/javascript" |
8912
|
|
|
}, |
8913
|
|
|
|
8914
|
|
|
contents: { |
8915
|
|
|
xml: /\bxml\b/, |
8916
|
|
|
html: /\bhtml/, |
8917
|
|
|
json: /\bjson\b/ |
8918
|
|
|
}, |
8919
|
|
|
|
8920
|
|
|
responseFields: { |
8921
|
|
|
xml: "responseXML", |
8922
|
|
|
text: "responseText", |
8923
|
|
|
json: "responseJSON" |
8924
|
|
|
}, |
8925
|
|
|
|
8926
|
|
|
// Data converters |
8927
|
|
|
// Keys separate source (or catchall "*") and destination types with a single space |
8928
|
|
|
converters: { |
8929
|
|
|
|
8930
|
|
|
// Convert anything to text |
8931
|
|
|
"* text": String, |
8932
|
|
|
|
8933
|
|
|
// Text to html (true = no transformation) |
8934
|
|
|
"text html": true, |
8935
|
|
|
|
8936
|
|
|
// Evaluate text as a json expression |
8937
|
|
|
"text json": JSON.parse, |
8938
|
|
|
|
8939
|
|
|
// Parse text as xml |
8940
|
|
|
"text xml": jQuery.parseXML |
8941
|
|
|
}, |
8942
|
|
|
|
8943
|
|
|
// For options that shouldn't be deep extended: |
8944
|
|
|
// you can add your own custom options here if |
8945
|
|
|
// and when you create one that shouldn't be |
8946
|
|
|
// deep extended (see ajaxExtend) |
8947
|
|
|
flatOptions: { |
8948
|
|
|
url: true, |
8949
|
|
|
context: true |
8950
|
|
|
} |
8951
|
|
|
}, |
8952
|
|
|
|
8953
|
|
|
// Creates a full fledged settings object into target |
8954
|
|
|
// with both ajaxSettings and settings fields. |
8955
|
|
|
// If target is omitted, writes into ajaxSettings. |
8956
|
|
|
ajaxSetup: function( target, settings ) { |
8957
|
|
|
return settings ? |
8958
|
|
|
|
8959
|
|
|
// Building a settings object |
8960
|
|
|
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : |
8961
|
|
|
|
8962
|
|
|
// Extending ajaxSettings |
8963
|
|
|
ajaxExtend( jQuery.ajaxSettings, target ); |
8964
|
|
|
}, |
8965
|
|
|
|
8966
|
|
|
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), |
8967
|
|
|
ajaxTransport: addToPrefiltersOrTransports( transports ), |
8968
|
|
|
|
8969
|
|
|
// Main method |
8970
|
|
|
ajax: function( url, options ) { |
8971
|
|
|
|
8972
|
|
|
// If url is an object, simulate pre-1.5 signature |
8973
|
|
|
if ( typeof url === "object" ) { |
8974
|
|
|
options = url; |
8975
|
|
|
url = undefined; |
8976
|
|
|
} |
8977
|
|
|
|
8978
|
|
|
// Force options to be an object |
8979
|
|
|
options = options || {}; |
8980
|
|
|
|
8981
|
|
|
var transport, |
8982
|
|
|
|
8983
|
|
|
// URL without anti-cache param |
8984
|
|
|
cacheURL, |
8985
|
|
|
|
8986
|
|
|
// Response headers |
8987
|
|
|
responseHeadersString, |
8988
|
|
|
responseHeaders, |
8989
|
|
|
|
8990
|
|
|
// timeout handle |
8991
|
|
|
timeoutTimer, |
8992
|
|
|
|
8993
|
|
|
// Url cleanup var |
8994
|
|
|
urlAnchor, |
8995
|
|
|
|
8996
|
|
|
// Request state (becomes false upon send and true upon completion) |
8997
|
|
|
completed, |
8998
|
|
|
|
8999
|
|
|
// To know if global events are to be dispatched |
9000
|
|
|
fireGlobals, |
9001
|
|
|
|
9002
|
|
|
// Loop variable |
9003
|
|
|
i, |
9004
|
|
|
|
9005
|
|
|
// uncached part of the url |
9006
|
|
|
uncached, |
9007
|
|
|
|
9008
|
|
|
// Create the final options object |
9009
|
|
|
s = jQuery.ajaxSetup( {}, options ), |
9010
|
|
|
|
9011
|
|
|
// Callbacks context |
9012
|
|
|
callbackContext = s.context || s, |
9013
|
|
|
|
9014
|
|
|
// Context for global events is callbackContext if it is a DOM node or jQuery collection |
9015
|
|
|
globalEventContext = s.context && |
9016
|
|
|
( callbackContext.nodeType || callbackContext.jquery ) ? |
9017
|
|
|
jQuery( callbackContext ) : |
9018
|
|
|
jQuery.event, |
9019
|
|
|
|
9020
|
|
|
// Deferreds |
9021
|
|
|
deferred = jQuery.Deferred(), |
9022
|
|
|
completeDeferred = jQuery.Callbacks( "once memory" ), |
9023
|
|
|
|
9024
|
|
|
// Status-dependent callbacks |
9025
|
|
|
statusCode = s.statusCode || {}, |
9026
|
|
|
|
9027
|
|
|
// Headers (they are sent all at once) |
9028
|
|
|
requestHeaders = {}, |
9029
|
|
|
requestHeadersNames = {}, |
9030
|
|
|
|
9031
|
|
|
// Default abort message |
9032
|
|
|
strAbort = "canceled", |
9033
|
|
|
|
9034
|
|
|
// Fake xhr |
9035
|
|
|
jqXHR = { |
9036
|
|
|
readyState: 0, |
9037
|
|
|
|
9038
|
|
|
// Builds headers hashtable if needed |
9039
|
|
|
getResponseHeader: function( key ) { |
9040
|
|
|
var match; |
9041
|
|
|
if ( completed ) { |
9042
|
|
|
if ( !responseHeaders ) { |
9043
|
|
|
responseHeaders = {}; |
9044
|
|
|
while ( ( match = rheaders.exec( responseHeadersString ) ) ) { |
9045
|
|
|
responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; |
9046
|
|
|
} |
9047
|
|
|
} |
9048
|
|
|
match = responseHeaders[ key.toLowerCase() ]; |
9049
|
|
|
} |
9050
|
|
|
return match == null ? null : match; |
9051
|
|
|
}, |
9052
|
|
|
|
9053
|
|
|
// Raw string |
9054
|
|
|
getAllResponseHeaders: function() { |
9055
|
|
|
return completed ? responseHeadersString : null; |
9056
|
|
|
}, |
9057
|
|
|
|
9058
|
|
|
// Caches the header |
9059
|
|
|
setRequestHeader: function( name, value ) { |
9060
|
|
|
if ( completed == null ) { |
9061
|
|
|
name = requestHeadersNames[ name.toLowerCase() ] = |
9062
|
|
|
requestHeadersNames[ name.toLowerCase() ] || name; |
9063
|
|
|
requestHeaders[ name ] = value; |
9064
|
|
|
} |
9065
|
|
|
return this; |
9066
|
|
|
}, |
9067
|
|
|
|
9068
|
|
|
// Overrides response content-type header |
9069
|
|
|
overrideMimeType: function( type ) { |
9070
|
|
|
if ( completed == null ) { |
9071
|
|
|
s.mimeType = type; |
9072
|
|
|
} |
9073
|
|
|
return this; |
9074
|
|
|
}, |
9075
|
|
|
|
9076
|
|
|
// Status-dependent callbacks |
9077
|
|
|
statusCode: function( map ) { |
9078
|
|
|
var code; |
9079
|
|
|
if ( map ) { |
9080
|
|
|
if ( completed ) { |
9081
|
|
|
|
9082
|
|
|
// Execute the appropriate callbacks |
9083
|
|
|
jqXHR.always( map[ jqXHR.status ] ); |
9084
|
|
|
} else { |
9085
|
|
|
|
9086
|
|
|
// Lazy-add the new callbacks in a way that preserves old ones |
9087
|
|
|
for ( code in map ) { |
9088
|
|
|
statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; |
9089
|
|
|
} |
9090
|
|
|
} |
9091
|
|
|
} |
9092
|
|
|
return this; |
9093
|
|
|
}, |
9094
|
|
|
|
9095
|
|
|
// Cancel the request |
9096
|
|
|
abort: function( statusText ) { |
9097
|
|
|
var finalText = statusText || strAbort; |
9098
|
|
|
if ( transport ) { |
9099
|
|
|
transport.abort( finalText ); |
9100
|
|
|
} |
9101
|
|
|
done( 0, finalText ); |
9102
|
|
|
return this; |
9103
|
|
|
} |
9104
|
|
|
}; |
9105
|
|
|
|
9106
|
|
|
// Attach deferreds |
9107
|
|
|
deferred.promise( jqXHR ); |
9108
|
|
|
|
9109
|
|
|
// Add protocol if not provided (prefilters might expect it) |
9110
|
|
|
// Handle falsy url in the settings object (#10093: consistency with old signature) |
9111
|
|
|
// We also use the url parameter if available |
9112
|
|
|
s.url = ( ( url || s.url || location.href ) + "" ) |
9113
|
|
|
.replace( rprotocol, location.protocol + "//" ); |
9114
|
|
|
|
9115
|
|
|
// Alias method option to type as per ticket #12004 |
9116
|
|
|
s.type = options.method || options.type || s.method || s.type; |
9117
|
|
|
|
9118
|
|
|
// Extract dataTypes list |
9119
|
|
|
s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; |
9120
|
|
|
|
9121
|
|
|
// A cross-domain request is in order when the origin doesn't match the current origin. |
9122
|
|
|
if ( s.crossDomain == null ) { |
9123
|
|
|
urlAnchor = document.createElement( "a" ); |
9124
|
|
|
|
9125
|
|
|
// Support: IE <=8 - 11, Edge 12 - 15 |
9126
|
|
|
// IE throws exception on accessing the href property if url is malformed, |
9127
|
|
|
// e.g. http://example.com:80x/ |
9128
|
|
|
try { |
9129
|
|
|
urlAnchor.href = s.url; |
9130
|
|
|
|
9131
|
|
|
// Support: IE <=8 - 11 only |
9132
|
|
|
// Anchor's host property isn't correctly set when s.url is relative |
9133
|
|
|
urlAnchor.href = urlAnchor.href; |
9134
|
|
|
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== |
9135
|
|
|
urlAnchor.protocol + "//" + urlAnchor.host; |
9136
|
|
|
} catch ( e ) { |
9137
|
|
|
|
9138
|
|
|
// If there is an error parsing the URL, assume it is crossDomain, |
9139
|
|
|
// it can be rejected by the transport if it is invalid |
9140
|
|
|
s.crossDomain = true; |
9141
|
|
|
} |
9142
|
|
|
} |
9143
|
|
|
|
9144
|
|
|
// Convert data if not already a string |
9145
|
|
|
if ( s.data && s.processData && typeof s.data !== "string" ) { |
9146
|
|
|
s.data = jQuery.param( s.data, s.traditional ); |
9147
|
|
|
} |
9148
|
|
|
|
9149
|
|
|
// Apply prefilters |
9150
|
|
|
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); |
9151
|
|
|
|
9152
|
|
|
// If request was aborted inside a prefilter, stop there |
9153
|
|
|
if ( completed ) { |
9154
|
|
|
return jqXHR; |
9155
|
|
|
} |
9156
|
|
|
|
9157
|
|
|
// We can fire global events as of now if asked to |
9158
|
|
|
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) |
9159
|
|
|
fireGlobals = jQuery.event && s.global; |
9160
|
|
|
|
9161
|
|
|
// Watch for a new set of requests |
9162
|
|
|
if ( fireGlobals && jQuery.active++ === 0 ) { |
9163
|
|
|
jQuery.event.trigger( "ajaxStart" ); |
9164
|
|
|
} |
9165
|
|
|
|
9166
|
|
|
// Uppercase the type |
9167
|
|
|
s.type = s.type.toUpperCase(); |
9168
|
|
|
|
9169
|
|
|
// Determine if request has content |
9170
|
|
|
s.hasContent = !rnoContent.test( s.type ); |
9171
|
|
|
|
9172
|
|
|
// Save the URL in case we're toying with the If-Modified-Since |
9173
|
|
|
// and/or If-None-Match header later on |
9174
|
|
|
// Remove hash to simplify url manipulation |
9175
|
|
|
cacheURL = s.url.replace( rhash, "" ); |
9176
|
|
|
|
9177
|
|
|
// More options handling for requests with no content |
9178
|
|
|
if ( !s.hasContent ) { |
9179
|
|
|
|
9180
|
|
|
// Remember the hash so we can put it back |
9181
|
|
|
uncached = s.url.slice( cacheURL.length ); |
9182
|
|
|
|
9183
|
|
|
// If data is available and should be processed, append data to url |
9184
|
|
|
if ( s.data && ( s.processData || typeof s.data === "string" ) ) { |
9185
|
|
|
cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; |
9186
|
|
|
|
9187
|
|
|
// #9682: remove data so that it's not used in an eventual retry |
9188
|
|
|
delete s.data; |
9189
|
|
|
} |
9190
|
|
|
|
9191
|
|
|
// Add or update anti-cache param if needed |
9192
|
|
|
if ( s.cache === false ) { |
9193
|
|
|
cacheURL = cacheURL.replace( rantiCache, "$1" ); |
9194
|
|
|
uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; |
9195
|
|
|
} |
9196
|
|
|
|
9197
|
|
|
// Put hash and anti-cache on the URL that will be requested (gh-1732) |
9198
|
|
|
s.url = cacheURL + uncached; |
9199
|
|
|
|
9200
|
|
|
// Change '%20' to '+' if this is encoded form body content (gh-2658) |
9201
|
|
|
} else if ( s.data && s.processData && |
9202
|
|
|
( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { |
9203
|
|
|
s.data = s.data.replace( r20, "+" ); |
9204
|
|
|
} |
9205
|
|
|
|
9206
|
|
|
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
9207
|
|
|
if ( s.ifModified ) { |
9208
|
|
|
if ( jQuery.lastModified[ cacheURL ] ) { |
9209
|
|
|
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); |
9210
|
|
|
} |
9211
|
|
|
if ( jQuery.etag[ cacheURL ] ) { |
9212
|
|
|
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); |
9213
|
|
|
} |
9214
|
|
|
} |
9215
|
|
|
|
9216
|
|
|
// Set the correct header, if data is being sent |
9217
|
|
|
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { |
9218
|
|
|
jqXHR.setRequestHeader( "Content-Type", s.contentType ); |
9219
|
|
|
} |
9220
|
|
|
|
9221
|
|
|
// Set the Accepts header for the server, depending on the dataType |
9222
|
|
|
jqXHR.setRequestHeader( |
9223
|
|
|
"Accept", |
9224
|
|
|
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? |
9225
|
|
|
s.accepts[ s.dataTypes[ 0 ] ] + |
9226
|
|
|
( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : |
9227
|
|
|
s.accepts[ "*" ] |
9228
|
|
|
); |
9229
|
|
|
|
9230
|
|
|
// Check for headers option |
9231
|
|
|
for ( i in s.headers ) { |
9232
|
|
|
jqXHR.setRequestHeader( i, s.headers[ i ] ); |
9233
|
|
|
} |
9234
|
|
|
|
9235
|
|
|
// Allow custom headers/mimetypes and early abort |
9236
|
|
|
if ( s.beforeSend && |
9237
|
|
|
( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { |
9238
|
|
|
|
9239
|
|
|
// Abort if not done already and return |
9240
|
|
|
return jqXHR.abort(); |
9241
|
|
|
} |
9242
|
|
|
|
9243
|
|
|
// Aborting is no longer a cancellation |
9244
|
|
|
strAbort = "abort"; |
9245
|
|
|
|
9246
|
|
|
// Install callbacks on deferreds |
9247
|
|
|
completeDeferred.add( s.complete ); |
9248
|
|
|
jqXHR.done( s.success ); |
9249
|
|
|
jqXHR.fail( s.error ); |
9250
|
|
|
|
9251
|
|
|
// Get transport |
9252
|
|
|
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); |
9253
|
|
|
|
9254
|
|
|
// If no transport, we auto-abort |
9255
|
|
|
if ( !transport ) { |
9256
|
|
|
done( -1, "No Transport" ); |
9257
|
|
|
} else { |
9258
|
|
|
jqXHR.readyState = 1; |
9259
|
|
|
|
9260
|
|
|
// Send global event |
9261
|
|
|
if ( fireGlobals ) { |
9262
|
|
|
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); |
9263
|
|
|
} |
9264
|
|
|
|
9265
|
|
|
// If request was aborted inside ajaxSend, stop there |
9266
|
|
|
if ( completed ) { |
9267
|
|
|
return jqXHR; |
9268
|
|
|
} |
9269
|
|
|
|
9270
|
|
|
// Timeout |
9271
|
|
|
if ( s.async && s.timeout > 0 ) { |
9272
|
|
|
timeoutTimer = window.setTimeout( function() { |
9273
|
|
|
jqXHR.abort( "timeout" ); |
9274
|
|
|
}, s.timeout ); |
9275
|
|
|
} |
9276
|
|
|
|
9277
|
|
|
try { |
9278
|
|
|
completed = false; |
9279
|
|
|
transport.send( requestHeaders, done ); |
9280
|
|
|
} catch ( e ) { |
9281
|
|
|
|
9282
|
|
|
// Rethrow post-completion exceptions |
9283
|
|
|
if ( completed ) { |
9284
|
|
|
throw e; |
9285
|
|
|
} |
9286
|
|
|
|
9287
|
|
|
// Propagate others as results |
9288
|
|
|
done( -1, e ); |
9289
|
|
|
} |
9290
|
|
|
} |
9291
|
|
|
|
9292
|
|
|
// Callback for when everything is done |
9293
|
|
|
function done( status, nativeStatusText, responses, headers ) { |
9294
|
|
|
var isSuccess, success, error, response, modified, |
9295
|
|
|
statusText = nativeStatusText; |
9296
|
|
|
|
9297
|
|
|
// Ignore repeat invocations |
9298
|
|
|
if ( completed ) { |
9299
|
|
|
return; |
9300
|
|
|
} |
9301
|
|
|
|
9302
|
|
|
completed = true; |
9303
|
|
|
|
9304
|
|
|
// Clear timeout if it exists |
9305
|
|
|
if ( timeoutTimer ) { |
9306
|
|
|
window.clearTimeout( timeoutTimer ); |
9307
|
|
|
} |
9308
|
|
|
|
9309
|
|
|
// Dereference transport for early garbage collection |
9310
|
|
|
// (no matter how long the jqXHR object will be used) |
9311
|
|
|
transport = undefined; |
9312
|
|
|
|
9313
|
|
|
// Cache response headers |
9314
|
|
|
responseHeadersString = headers || ""; |
9315
|
|
|
|
9316
|
|
|
// Set readyState |
9317
|
|
|
jqXHR.readyState = status > 0 ? 4 : 0; |
9318
|
|
|
|
9319
|
|
|
// Determine if successful |
9320
|
|
|
isSuccess = status >= 200 && status < 300 || status === 304; |
9321
|
|
|
|
9322
|
|
|
// Get response data |
9323
|
|
|
if ( responses ) { |
9324
|
|
|
response = ajaxHandleResponses( s, jqXHR, responses ); |
9325
|
|
|
} |
9326
|
|
|
|
9327
|
|
|
// Convert no matter what (that way responseXXX fields are always set) |
9328
|
|
|
response = ajaxConvert( s, response, jqXHR, isSuccess ); |
9329
|
|
|
|
9330
|
|
|
// If successful, handle type chaining |
9331
|
|
|
if ( isSuccess ) { |
9332
|
|
|
|
9333
|
|
|
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
9334
|
|
|
if ( s.ifModified ) { |
9335
|
|
|
modified = jqXHR.getResponseHeader( "Last-Modified" ); |
9336
|
|
|
if ( modified ) { |
9337
|
|
|
jQuery.lastModified[ cacheURL ] = modified; |
9338
|
|
|
} |
9339
|
|
|
modified = jqXHR.getResponseHeader( "etag" ); |
9340
|
|
|
if ( modified ) { |
9341
|
|
|
jQuery.etag[ cacheURL ] = modified; |
9342
|
|
|
} |
9343
|
|
|
} |
9344
|
|
|
|
9345
|
|
|
// if no content |
9346
|
|
|
if ( status === 204 || s.type === "HEAD" ) { |
9347
|
|
|
statusText = "nocontent"; |
9348
|
|
|
|
9349
|
|
|
// if not modified |
9350
|
|
|
} else if ( status === 304 ) { |
9351
|
|
|
statusText = "notmodified"; |
9352
|
|
|
|
9353
|
|
|
// If we have data, let's convert it |
9354
|
|
|
} else { |
9355
|
|
|
statusText = response.state; |
9356
|
|
|
success = response.data; |
9357
|
|
|
error = response.error; |
9358
|
|
|
isSuccess = !error; |
9359
|
|
|
} |
9360
|
|
|
} else { |
9361
|
|
|
|
9362
|
|
|
// Extract error from statusText and normalize for non-aborts |
9363
|
|
|
error = statusText; |
9364
|
|
|
if ( status || !statusText ) { |
9365
|
|
|
statusText = "error"; |
9366
|
|
|
if ( status < 0 ) { |
9367
|
|
|
status = 0; |
9368
|
|
|
} |
9369
|
|
|
} |
9370
|
|
|
} |
9371
|
|
|
|
9372
|
|
|
// Set data for the fake xhr object |
9373
|
|
|
jqXHR.status = status; |
9374
|
|
|
jqXHR.statusText = ( nativeStatusText || statusText ) + ""; |
9375
|
|
|
|
9376
|
|
|
// Success/Error |
9377
|
|
|
if ( isSuccess ) { |
9378
|
|
|
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); |
9379
|
|
|
} else { |
9380
|
|
|
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); |
9381
|
|
|
} |
9382
|
|
|
|
9383
|
|
|
// Status-dependent callbacks |
9384
|
|
|
jqXHR.statusCode( statusCode ); |
9385
|
|
|
statusCode = undefined; |
9386
|
|
|
|
9387
|
|
|
if ( fireGlobals ) { |
9388
|
|
|
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", |
9389
|
|
|
[ jqXHR, s, isSuccess ? success : error ] ); |
9390
|
|
|
} |
9391
|
|
|
|
9392
|
|
|
// Complete |
9393
|
|
|
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); |
9394
|
|
|
|
9395
|
|
|
if ( fireGlobals ) { |
9396
|
|
|
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); |
9397
|
|
|
|
9398
|
|
|
// Handle the global AJAX counter |
9399
|
|
|
if ( !( --jQuery.active ) ) { |
9400
|
|
|
jQuery.event.trigger( "ajaxStop" ); |
9401
|
|
|
} |
9402
|
|
|
} |
9403
|
|
|
} |
9404
|
|
|
|
9405
|
|
|
return jqXHR; |
9406
|
|
|
}, |
9407
|
|
|
|
9408
|
|
|
getJSON: function( url, data, callback ) { |
9409
|
|
|
return jQuery.get( url, data, callback, "json" ); |
9410
|
|
|
}, |
9411
|
|
|
|
9412
|
|
|
getScript: function( url, callback ) { |
9413
|
|
|
return jQuery.get( url, undefined, callback, "script" ); |
9414
|
|
|
} |
9415
|
|
|
} ); |
9416
|
|
|
|
9417
|
|
|
jQuery.each( [ "get", "post" ], function( i, method ) { |
9418
|
|
|
jQuery[ method ] = function( url, data, callback, type ) { |
9419
|
|
|
|
9420
|
|
|
// Shift arguments if data argument was omitted |
9421
|
|
|
if ( isFunction( data ) ) { |
9422
|
|
|
type = type || callback; |
9423
|
|
|
callback = data; |
9424
|
|
|
data = undefined; |
9425
|
|
|
} |
9426
|
|
|
|
9427
|
|
|
// The url can be an options object (which then must have .url) |
9428
|
|
|
return jQuery.ajax( jQuery.extend( { |
9429
|
|
|
url: url, |
9430
|
|
|
type: method, |
9431
|
|
|
dataType: type, |
9432
|
|
|
data: data, |
9433
|
|
|
success: callback |
9434
|
|
|
}, jQuery.isPlainObject( url ) && url ) ); |
9435
|
|
|
}; |
9436
|
|
|
} ); |
9437
|
|
|
|
9438
|
|
|
|
9439
|
|
|
jQuery._evalUrl = function( url ) { |
9440
|
|
|
return jQuery.ajax( { |
9441
|
|
|
url: url, |
9442
|
|
|
|
9443
|
|
|
// Make this explicit, since user can override this through ajaxSetup (#11264) |
9444
|
|
|
type: "GET", |
9445
|
|
|
dataType: "script", |
9446
|
|
|
cache: true, |
9447
|
|
|
async: false, |
9448
|
|
|
global: false, |
9449
|
|
|
"throws": true |
9450
|
|
|
} ); |
9451
|
|
|
}; |
9452
|
|
|
|
9453
|
|
|
|
9454
|
|
|
jQuery.fn.extend( { |
9455
|
|
|
wrapAll: function( html ) { |
9456
|
|
|
var wrap; |
9457
|
|
|
|
9458
|
|
|
if ( this[ 0 ] ) { |
9459
|
|
|
if ( isFunction( html ) ) { |
9460
|
|
|
html = html.call( this[ 0 ] ); |
9461
|
|
|
} |
9462
|
|
|
|
9463
|
|
|
// The elements to wrap the target around |
9464
|
|
|
wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); |
9465
|
|
|
|
9466
|
|
|
if ( this[ 0 ].parentNode ) { |
9467
|
|
|
wrap.insertBefore( this[ 0 ] ); |
9468
|
|
|
} |
9469
|
|
|
|
9470
|
|
|
wrap.map( function() { |
9471
|
|
|
var elem = this; |
9472
|
|
|
|
9473
|
|
|
while ( elem.firstElementChild ) { |
9474
|
|
|
elem = elem.firstElementChild; |
9475
|
|
|
} |
9476
|
|
|
|
9477
|
|
|
return elem; |
9478
|
|
|
} ).append( this ); |
9479
|
|
|
} |
9480
|
|
|
|
9481
|
|
|
return this; |
9482
|
|
|
}, |
9483
|
|
|
|
9484
|
|
|
wrapInner: function( html ) { |
9485
|
|
|
if ( isFunction( html ) ) { |
9486
|
|
|
return this.each( function( i ) { |
9487
|
|
|
jQuery( this ).wrapInner( html.call( this, i ) ); |
9488
|
|
|
} ); |
9489
|
|
|
} |
9490
|
|
|
|
9491
|
|
|
return this.each( function() { |
9492
|
|
|
var self = jQuery( this ), |
9493
|
|
|
contents = self.contents(); |
9494
|
|
|
|
9495
|
|
|
if ( contents.length ) { |
9496
|
|
|
contents.wrapAll( html ); |
9497
|
|
|
|
9498
|
|
|
} else { |
9499
|
|
|
self.append( html ); |
9500
|
|
|
} |
9501
|
|
|
} ); |
9502
|
|
|
}, |
9503
|
|
|
|
9504
|
|
|
wrap: function( html ) { |
9505
|
|
|
var htmlIsFunction = isFunction( html ); |
9506
|
|
|
|
9507
|
|
|
return this.each( function( i ) { |
9508
|
|
|
jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); |
9509
|
|
|
} ); |
9510
|
|
|
}, |
9511
|
|
|
|
9512
|
|
|
unwrap: function( selector ) { |
9513
|
|
|
this.parent( selector ).not( "body" ).each( function() { |
9514
|
|
|
jQuery( this ).replaceWith( this.childNodes ); |
9515
|
|
|
} ); |
9516
|
|
|
return this; |
9517
|
|
|
} |
9518
|
|
|
} ); |
9519
|
|
|
|
9520
|
|
|
|
9521
|
|
|
jQuery.expr.pseudos.hidden = function( elem ) { |
9522
|
|
|
return !jQuery.expr.pseudos.visible( elem ); |
9523
|
|
|
}; |
9524
|
|
|
jQuery.expr.pseudos.visible = function( elem ) { |
9525
|
|
|
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); |
9526
|
|
|
}; |
9527
|
|
|
|
9528
|
|
|
|
9529
|
|
|
|
9530
|
|
|
|
9531
|
|
|
jQuery.ajaxSettings.xhr = function() { |
9532
|
|
|
try { |
9533
|
|
|
return new window.XMLHttpRequest(); |
9534
|
|
|
} catch ( e ) {} |
9535
|
|
|
}; |
9536
|
|
|
|
9537
|
|
|
var xhrSuccessStatus = { |
9538
|
|
|
|
9539
|
|
|
// File protocol always yields status code 0, assume 200 |
9540
|
|
|
0: 200, |
9541
|
|
|
|
9542
|
|
|
// Support: IE <=9 only |
9543
|
|
|
// #1450: sometimes IE returns 1223 when it should be 204 |
9544
|
|
|
1223: 204 |
9545
|
|
|
}, |
9546
|
|
|
xhrSupported = jQuery.ajaxSettings.xhr(); |
9547
|
|
|
|
9548
|
|
|
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); |
9549
|
|
|
support.ajax = xhrSupported = !!xhrSupported; |
9550
|
|
|
|
9551
|
|
|
jQuery.ajaxTransport( function( options ) { |
9552
|
|
|
var callback, errorCallback; |
9553
|
|
|
|
9554
|
|
|
// Cross domain only allowed if supported through XMLHttpRequest |
9555
|
|
|
if ( support.cors || xhrSupported && !options.crossDomain ) { |
9556
|
|
|
return { |
9557
|
|
|
send: function( headers, complete ) { |
9558
|
|
|
var i, |
9559
|
|
|
xhr = options.xhr(); |
9560
|
|
|
|
9561
|
|
|
xhr.open( |
9562
|
|
|
options.type, |
9563
|
|
|
options.url, |
9564
|
|
|
options.async, |
9565
|
|
|
options.username, |
9566
|
|
|
options.password |
9567
|
|
|
); |
9568
|
|
|
|
9569
|
|
|
// Apply custom fields if provided |
9570
|
|
|
if ( options.xhrFields ) { |
9571
|
|
|
for ( i in options.xhrFields ) { |
9572
|
|
|
xhr[ i ] = options.xhrFields[ i ]; |
9573
|
|
|
} |
9574
|
|
|
} |
9575
|
|
|
|
9576
|
|
|
// Override mime type if needed |
9577
|
|
|
if ( options.mimeType && xhr.overrideMimeType ) { |
9578
|
|
|
xhr.overrideMimeType( options.mimeType ); |
9579
|
|
|
} |
9580
|
|
|
|
9581
|
|
|
// X-Requested-With header |
9582
|
|
|
// For cross-domain requests, seeing as conditions for a preflight are |
9583
|
|
|
// akin to a jigsaw puzzle, we simply never set it to be sure. |
9584
|
|
|
// (it can always be set on a per-request basis or even using ajaxSetup) |
9585
|
|
|
// For same-domain requests, won't change header if already provided. |
9586
|
|
|
if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { |
9587
|
|
|
headers[ "X-Requested-With" ] = "XMLHttpRequest"; |
9588
|
|
|
} |
9589
|
|
|
|
9590
|
|
|
// Set headers |
9591
|
|
|
for ( i in headers ) { |
9592
|
|
|
xhr.setRequestHeader( i, headers[ i ] ); |
9593
|
|
|
} |
9594
|
|
|
|
9595
|
|
|
// Callback |
9596
|
|
|
callback = function( type ) { |
9597
|
|
|
return function() { |
9598
|
|
|
if ( callback ) { |
9599
|
|
|
callback = errorCallback = xhr.onload = |
9600
|
|
|
xhr.onerror = xhr.onabort = xhr.ontimeout = |
9601
|
|
|
xhr.onreadystatechange = null; |
9602
|
|
|
|
9603
|
|
|
if ( type === "abort" ) { |
9604
|
|
|
xhr.abort(); |
9605
|
|
|
} else if ( type === "error" ) { |
9606
|
|
|
|
9607
|
|
|
// Support: IE <=9 only |
9608
|
|
|
// On a manual native abort, IE9 throws |
9609
|
|
|
// errors on any property access that is not readyState |
9610
|
|
|
if ( typeof xhr.status !== "number" ) { |
9611
|
|
|
complete( 0, "error" ); |
9612
|
|
|
} else { |
9613
|
|
|
complete( |
9614
|
|
|
|
9615
|
|
|
// File: protocol always yields status 0; see #8605, #14207 |
9616
|
|
|
xhr.status, |
9617
|
|
|
xhr.statusText |
9618
|
|
|
); |
9619
|
|
|
} |
9620
|
|
|
} else { |
9621
|
|
|
complete( |
9622
|
|
|
xhrSuccessStatus[ xhr.status ] || xhr.status, |
9623
|
|
|
xhr.statusText, |
9624
|
|
|
|
9625
|
|
|
// Support: IE <=9 only |
9626
|
|
|
// IE9 has no XHR2 but throws on binary (trac-11426) |
9627
|
|
|
// For XHR2 non-text, let the caller handle it (gh-2498) |
9628
|
|
|
( xhr.responseType || "text" ) !== "text" || |
9629
|
|
|
typeof xhr.responseText !== "string" ? |
9630
|
|
|
{ binary: xhr.response } : |
9631
|
|
|
{ text: xhr.responseText }, |
9632
|
|
|
xhr.getAllResponseHeaders() |
9633
|
|
|
); |
9634
|
|
|
} |
9635
|
|
|
} |
9636
|
|
|
}; |
9637
|
|
|
}; |
9638
|
|
|
|
9639
|
|
|
// Listen to events |
9640
|
|
|
xhr.onload = callback(); |
9641
|
|
|
errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); |
9642
|
|
|
|
9643
|
|
|
// Support: IE 9 only |
9644
|
|
|
// Use onreadystatechange to replace onabort |
9645
|
|
|
// to handle uncaught aborts |
9646
|
|
|
if ( xhr.onabort !== undefined ) { |
9647
|
|
|
xhr.onabort = errorCallback; |
9648
|
|
|
} else { |
9649
|
|
|
xhr.onreadystatechange = function() { |
9650
|
|
|
|
9651
|
|
|
// Check readyState before timeout as it changes |
9652
|
|
|
if ( xhr.readyState === 4 ) { |
9653
|
|
|
|
9654
|
|
|
// Allow onerror to be called first, |
9655
|
|
|
// but that will not handle a native abort |
9656
|
|
|
// Also, save errorCallback to a variable |
9657
|
|
|
// as xhr.onerror cannot be accessed |
9658
|
|
|
window.setTimeout( function() { |
9659
|
|
|
if ( callback ) { |
9660
|
|
|
errorCallback(); |
9661
|
|
|
} |
9662
|
|
|
} ); |
9663
|
|
|
} |
9664
|
|
|
}; |
9665
|
|
|
} |
9666
|
|
|
|
9667
|
|
|
// Create the abort callback |
9668
|
|
|
callback = callback( "abort" ); |
9669
|
|
|
|
9670
|
|
|
try { |
9671
|
|
|
|
9672
|
|
|
// Do send the request (this may raise an exception) |
9673
|
|
|
xhr.send( options.hasContent && options.data || null ); |
9674
|
|
|
} catch ( e ) { |
9675
|
|
|
|
9676
|
|
|
// #14683: Only rethrow if this hasn't been notified as an error yet |
9677
|
|
|
if ( callback ) { |
9678
|
|
|
throw e; |
9679
|
|
|
} |
9680
|
|
|
} |
9681
|
|
|
}, |
9682
|
|
|
|
9683
|
|
|
abort: function() { |
9684
|
|
|
if ( callback ) { |
9685
|
|
|
callback(); |
9686
|
|
|
} |
9687
|
|
|
} |
9688
|
|
|
}; |
9689
|
|
|
} |
9690
|
|
|
} ); |
9691
|
|
|
|
9692
|
|
|
|
9693
|
|
|
|
9694
|
|
|
|
9695
|
|
|
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) |
9696
|
|
|
jQuery.ajaxPrefilter( function( s ) { |
9697
|
|
|
if ( s.crossDomain ) { |
9698
|
|
|
s.contents.script = false; |
9699
|
|
|
} |
9700
|
|
|
} ); |
9701
|
|
|
|
9702
|
|
|
// Install script dataType |
9703
|
|
|
jQuery.ajaxSetup( { |
9704
|
|
|
accepts: { |
9705
|
|
|
script: "text/javascript, application/javascript, " + |
9706
|
|
|
"application/ecmascript, application/x-ecmascript" |
9707
|
|
|
}, |
9708
|
|
|
contents: { |
9709
|
|
|
script: /\b(?:java|ecma)script\b/ |
9710
|
|
|
}, |
9711
|
|
|
converters: { |
9712
|
|
|
"text script": function( text ) { |
9713
|
|
|
jQuery.globalEval( text ); |
9714
|
|
|
return text; |
9715
|
|
|
} |
9716
|
|
|
} |
9717
|
|
|
} ); |
9718
|
|
|
|
9719
|
|
|
// Handle cache's special case and crossDomain |
9720
|
|
|
jQuery.ajaxPrefilter( "script", function( s ) { |
9721
|
|
|
if ( s.cache === undefined ) { |
9722
|
|
|
s.cache = false; |
9723
|
|
|
} |
9724
|
|
|
if ( s.crossDomain ) { |
9725
|
|
|
s.type = "GET"; |
9726
|
|
|
} |
9727
|
|
|
} ); |
9728
|
|
|
|
9729
|
|
|
// Bind script tag hack transport |
9730
|
|
|
jQuery.ajaxTransport( "script", function( s ) { |
9731
|
|
|
|
9732
|
|
|
// This transport only deals with cross domain requests |
9733
|
|
|
if ( s.crossDomain ) { |
9734
|
|
|
var script, callback; |
9735
|
|
|
return { |
9736
|
|
|
send: function( _, complete ) { |
9737
|
|
|
script = jQuery( "<script>" ).prop( { |
9738
|
|
|
charset: s.scriptCharset, |
9739
|
|
|
src: s.url |
9740
|
|
|
} ).on( |
9741
|
|
|
"load error", |
9742
|
|
|
callback = function( evt ) { |
9743
|
|
|
script.remove(); |
9744
|
|
|
callback = null; |
9745
|
|
|
if ( evt ) { |
9746
|
|
|
complete( evt.type === "error" ? 404 : 200, evt.type ); |
9747
|
|
|
} |
9748
|
|
|
} |
9749
|
|
|
); |
9750
|
|
|
|
9751
|
|
|
// Use native DOM manipulation to avoid our domManip AJAX trickery |
9752
|
|
|
document.head.appendChild( script[ 0 ] ); |
9753
|
|
|
}, |
9754
|
|
|
abort: function() { |
9755
|
|
|
if ( callback ) { |
9756
|
|
|
callback(); |
9757
|
|
|
} |
9758
|
|
|
} |
9759
|
|
|
}; |
9760
|
|
|
} |
9761
|
|
|
} ); |
9762
|
|
|
|
9763
|
|
|
|
9764
|
|
|
|
9765
|
|
|
|
9766
|
|
|
var oldCallbacks = [], |
9767
|
|
|
rjsonp = /(=)\?(?=&|$)|\?\?/; |
9768
|
|
|
|
9769
|
|
|
// Default jsonp settings |
9770
|
|
|
jQuery.ajaxSetup( { |
9771
|
|
|
jsonp: "callback", |
9772
|
|
|
jsonpCallback: function() { |
9773
|
|
|
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); |
9774
|
|
|
this[ callback ] = true; |
9775
|
|
|
return callback; |
9776
|
|
|
} |
9777
|
|
|
} ); |
9778
|
|
|
|
9779
|
|
|
// Detect, normalize options and install callbacks for jsonp requests |
9780
|
|
|
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { |
9781
|
|
|
|
9782
|
|
|
var callbackName, overwritten, responseContainer, |
9783
|
|
|
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? |
9784
|
|
|
"url" : |
9785
|
|
|
typeof s.data === "string" && |
9786
|
|
|
( s.contentType || "" ) |
9787
|
|
|
.indexOf( "application/x-www-form-urlencoded" ) === 0 && |
9788
|
|
|
rjsonp.test( s.data ) && "data" |
9789
|
|
|
); |
9790
|
|
|
|
9791
|
|
|
// Handle iff the expected data type is "jsonp" or we have a parameter to set |
9792
|
|
|
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { |
9793
|
|
|
|
9794
|
|
|
// Get callback name, remembering preexisting value associated with it |
9795
|
|
|
callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? |
9796
|
|
|
s.jsonpCallback() : |
9797
|
|
|
s.jsonpCallback; |
9798
|
|
|
|
9799
|
|
|
// Insert callback into url or form data |
9800
|
|
|
if ( jsonProp ) { |
9801
|
|
|
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); |
9802
|
|
|
} else if ( s.jsonp !== false ) { |
9803
|
|
|
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; |
9804
|
|
|
} |
9805
|
|
|
|
9806
|
|
|
// Use data converter to retrieve json after script execution |
9807
|
|
|
s.converters[ "script json" ] = function() { |
9808
|
|
|
if ( !responseContainer ) { |
9809
|
|
|
jQuery.error( callbackName + " was not called" ); |
9810
|
|
|
} |
9811
|
|
|
return responseContainer[ 0 ]; |
9812
|
|
|
}; |
9813
|
|
|
|
9814
|
|
|
// Force json dataType |
9815
|
|
|
s.dataTypes[ 0 ] = "json"; |
9816
|
|
|
|
9817
|
|
|
// Install callback |
9818
|
|
|
overwritten = window[ callbackName ]; |
9819
|
|
|
window[ callbackName ] = function() { |
9820
|
|
|
responseContainer = arguments; |
9821
|
|
|
}; |
9822
|
|
|
|
9823
|
|
|
// Clean-up function (fires after converters) |
9824
|
|
|
jqXHR.always( function() { |
9825
|
|
|
|
9826
|
|
|
// If previous value didn't exist - remove it |
9827
|
|
|
if ( overwritten === undefined ) { |
9828
|
|
|
jQuery( window ).removeProp( callbackName ); |
9829
|
|
|
|
9830
|
|
|
// Otherwise restore preexisting value |
9831
|
|
|
} else { |
9832
|
|
|
window[ callbackName ] = overwritten; |
9833
|
|
|
} |
9834
|
|
|
|
9835
|
|
|
// Save back as free |
9836
|
|
|
if ( s[ callbackName ] ) { |
9837
|
|
|
|
9838
|
|
|
// Make sure that re-using the options doesn't screw things around |
9839
|
|
|
s.jsonpCallback = originalSettings.jsonpCallback; |
9840
|
|
|
|
9841
|
|
|
// Save the callback name for future use |
9842
|
|
|
oldCallbacks.push( callbackName ); |
9843
|
|
|
} |
9844
|
|
|
|
9845
|
|
|
// Call if it was a function and we have a response |
9846
|
|
|
if ( responseContainer && isFunction( overwritten ) ) { |
9847
|
|
|
overwritten( responseContainer[ 0 ] ); |
9848
|
|
|
} |
9849
|
|
|
|
9850
|
|
|
responseContainer = overwritten = undefined; |
9851
|
|
|
} ); |
9852
|
|
|
|
9853
|
|
|
// Delegate to script |
9854
|
|
|
return "script"; |
9855
|
|
|
} |
9856
|
|
|
} ); |
9857
|
|
|
|
9858
|
|
|
|
9859
|
|
|
|
9860
|
|
|
|
9861
|
|
|
// Support: Safari 8 only |
9862
|
|
|
// In Safari 8 documents created via document.implementation.createHTMLDocument |
9863
|
|
|
// collapse sibling forms: the second one becomes a child of the first one. |
9864
|
|
|
// Because of that, this security measure has to be disabled in Safari 8. |
9865
|
|
|
// https://bugs.webkit.org/show_bug.cgi?id=137337 |
9866
|
|
|
support.createHTMLDocument = ( function() { |
9867
|
|
|
var body = document.implementation.createHTMLDocument( "" ).body; |
9868
|
|
|
body.innerHTML = "<form></form><form></form>"; |
9869
|
|
|
return body.childNodes.length === 2; |
9870
|
|
|
} )(); |
9871
|
|
|
|
9872
|
|
|
|
9873
|
|
|
// Argument "data" should be string of html |
9874
|
|
|
// context (optional): If specified, the fragment will be created in this context, |
9875
|
|
|
// defaults to document |
9876
|
|
|
// keepScripts (optional): If true, will include scripts passed in the html string |
9877
|
|
|
jQuery.parseHTML = function( data, context, keepScripts ) { |
9878
|
|
|
if ( typeof data !== "string" ) { |
9879
|
|
|
return []; |
9880
|
|
|
} |
9881
|
|
|
if ( typeof context === "boolean" ) { |
9882
|
|
|
keepScripts = context; |
9883
|
|
|
context = false; |
9884
|
|
|
} |
9885
|
|
|
|
9886
|
|
|
var base, parsed, scripts; |
9887
|
|
|
|
9888
|
|
|
if ( !context ) { |
9889
|
|
|
|
9890
|
|
|
// Stop scripts or inline event handlers from being executed immediately |
9891
|
|
|
// by using document.implementation |
9892
|
|
|
if ( support.createHTMLDocument ) { |
9893
|
|
|
context = document.implementation.createHTMLDocument( "" ); |
9894
|
|
|
|
9895
|
|
|
// Set the base href for the created document |
9896
|
|
|
// so any parsed elements with URLs |
9897
|
|
|
// are based on the document's URL (gh-2965) |
9898
|
|
|
base = context.createElement( "base" ); |
9899
|
|
|
base.href = document.location.href; |
9900
|
|
|
context.head.appendChild( base ); |
9901
|
|
|
} else { |
9902
|
|
|
context = document; |
9903
|
|
|
} |
9904
|
|
|
} |
9905
|
|
|
|
9906
|
|
|
parsed = rsingleTag.exec( data ); |
9907
|
|
|
scripts = !keepScripts && []; |
9908
|
|
|
|
9909
|
|
|
// Single tag |
9910
|
|
|
if ( parsed ) { |
9911
|
|
|
return [ context.createElement( parsed[ 1 ] ) ]; |
9912
|
|
|
} |
9913
|
|
|
|
9914
|
|
|
parsed = buildFragment( [ data ], context, scripts ); |
9915
|
|
|
|
9916
|
|
|
if ( scripts && scripts.length ) { |
9917
|
|
|
jQuery( scripts ).remove(); |
9918
|
|
|
} |
9919
|
|
|
|
9920
|
|
|
return jQuery.merge( [], parsed.childNodes ); |
9921
|
|
|
}; |
9922
|
|
|
|
9923
|
|
|
|
9924
|
|
|
/** |
9925
|
|
|
* Load a url into a page |
9926
|
|
|
*/ |
9927
|
|
|
jQuery.fn.load = function( url, params, callback ) { |
9928
|
|
|
var selector, type, response, |
9929
|
|
|
self = this, |
9930
|
|
|
off = url.indexOf( " " ); |
9931
|
|
|
|
9932
|
|
|
if ( off > -1 ) { |
9933
|
|
|
selector = stripAndCollapse( url.slice( off ) ); |
9934
|
|
|
url = url.slice( 0, off ); |
9935
|
|
|
} |
9936
|
|
|
|
9937
|
|
|
// If it's a function |
9938
|
|
|
if ( isFunction( params ) ) { |
9939
|
|
|
|
9940
|
|
|
// We assume that it's the callback |
9941
|
|
|
callback = params; |
9942
|
|
|
params = undefined; |
9943
|
|
|
|
9944
|
|
|
// Otherwise, build a param string |
9945
|
|
|
} else if ( params && typeof params === "object" ) { |
9946
|
|
|
type = "POST"; |
9947
|
|
|
} |
9948
|
|
|
|
9949
|
|
|
// If we have elements to modify, make the request |
9950
|
|
|
if ( self.length > 0 ) { |
9951
|
|
|
jQuery.ajax( { |
9952
|
|
|
url: url, |
9953
|
|
|
|
9954
|
|
|
// If "type" variable is undefined, then "GET" method will be used. |
9955
|
|
|
// Make value of this field explicit since |
9956
|
|
|
// user can override it through ajaxSetup method |
9957
|
|
|
type: type || "GET", |
9958
|
|
|
dataType: "html", |
9959
|
|
|
data: params |
9960
|
|
|
} ).done( function( responseText ) { |
9961
|
|
|
|
9962
|
|
|
// Save response for use in complete callback |
9963
|
|
|
response = arguments; |
9964
|
|
|
|
9965
|
|
|
self.html( selector ? |
9966
|
|
|
|
9967
|
|
|
// If a selector was specified, locate the right elements in a dummy div |
9968
|
|
|
// Exclude scripts to avoid IE 'Permission Denied' errors |
9969
|
|
|
jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : |
9970
|
|
|
|
9971
|
|
|
// Otherwise use the full result |
9972
|
|
|
responseText ); |
9973
|
|
|
|
9974
|
|
|
// If the request succeeds, this function gets "data", "status", "jqXHR" |
9975
|
|
|
// but they are ignored because response was set above. |
9976
|
|
|
// If it fails, this function gets "jqXHR", "status", "error" |
9977
|
|
|
} ).always( callback && function( jqXHR, status ) { |
9978
|
|
|
self.each( function() { |
9979
|
|
|
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); |
9980
|
|
|
} ); |
9981
|
|
|
} ); |
9982
|
|
|
} |
9983
|
|
|
|
9984
|
|
|
return this; |
9985
|
|
|
}; |
9986
|
|
|
|
9987
|
|
|
|
9988
|
|
|
|
9989
|
|
|
|
9990
|
|
|
// Attach a bunch of functions for handling common AJAX events |
9991
|
|
|
jQuery.each( [ |
9992
|
|
|
"ajaxStart", |
9993
|
|
|
"ajaxStop", |
9994
|
|
|
"ajaxComplete", |
9995
|
|
|
"ajaxError", |
9996
|
|
|
"ajaxSuccess", |
9997
|
|
|
"ajaxSend" |
9998
|
|
|
], function( i, type ) { |
9999
|
|
|
jQuery.fn[ type ] = function( fn ) { |
10000
|
|
|
return this.on( type, fn ); |
10001
|
|
|
}; |
10002
|
|
|
} ); |
10003
|
|
|
|
10004
|
|
|
|
10005
|
|
|
|
10006
|
|
|
|
10007
|
|
|
jQuery.expr.pseudos.animated = function( elem ) { |
10008
|
|
|
return jQuery.grep( jQuery.timers, function( fn ) { |
10009
|
|
|
return elem === fn.elem; |
10010
|
|
|
} ).length; |
10011
|
|
|
}; |
10012
|
|
|
|
10013
|
|
|
|
10014
|
|
|
|
10015
|
|
|
|
10016
|
|
|
jQuery.offset = { |
10017
|
|
|
setOffset: function( elem, options, i ) { |
10018
|
|
|
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, |
10019
|
|
|
position = jQuery.css( elem, "position" ), |
10020
|
|
|
curElem = jQuery( elem ), |
10021
|
|
|
props = {}; |
10022
|
|
|
|
10023
|
|
|
// Set position first, in-case top/left are set even on static elem |
10024
|
|
|
if ( position === "static" ) { |
10025
|
|
|
elem.style.position = "relative"; |
10026
|
|
|
} |
10027
|
|
|
|
10028
|
|
|
curOffset = curElem.offset(); |
10029
|
|
|
curCSSTop = jQuery.css( elem, "top" ); |
10030
|
|
|
curCSSLeft = jQuery.css( elem, "left" ); |
10031
|
|
|
calculatePosition = ( position === "absolute" || position === "fixed" ) && |
10032
|
|
|
( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; |
10033
|
|
|
|
10034
|
|
|
// Need to be able to calculate position if either |
10035
|
|
|
// top or left is auto and position is either absolute or fixed |
10036
|
|
|
if ( calculatePosition ) { |
10037
|
|
|
curPosition = curElem.position(); |
10038
|
|
|
curTop = curPosition.top; |
10039
|
|
|
curLeft = curPosition.left; |
10040
|
|
|
|
10041
|
|
|
} else { |
10042
|
|
|
curTop = parseFloat( curCSSTop ) || 0; |
10043
|
|
|
curLeft = parseFloat( curCSSLeft ) || 0; |
10044
|
|
|
} |
10045
|
|
|
|
10046
|
|
|
if ( isFunction( options ) ) { |
10047
|
|
|
|
10048
|
|
|
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848) |
10049
|
|
|
options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); |
10050
|
|
|
} |
10051
|
|
|
|
10052
|
|
|
if ( options.top != null ) { |
10053
|
|
|
props.top = ( options.top - curOffset.top ) + curTop; |
10054
|
|
|
} |
10055
|
|
|
if ( options.left != null ) { |
10056
|
|
|
props.left = ( options.left - curOffset.left ) + curLeft; |
10057
|
|
|
} |
10058
|
|
|
|
10059
|
|
|
if ( "using" in options ) { |
10060
|
|
|
options.using.call( elem, props ); |
10061
|
|
|
|
10062
|
|
|
} else { |
10063
|
|
|
curElem.css( props ); |
10064
|
|
|
} |
10065
|
|
|
} |
10066
|
|
|
}; |
10067
|
|
|
|
10068
|
|
|
jQuery.fn.extend( { |
10069
|
|
|
|
10070
|
|
|
// offset() relates an element's border box to the document origin |
10071
|
|
|
offset: function( options ) { |
10072
|
|
|
|
10073
|
|
|
// Preserve chaining for setter |
10074
|
|
|
if ( arguments.length ) { |
10075
|
|
|
return options === undefined ? |
10076
|
|
|
this : |
10077
|
|
|
this.each( function( i ) { |
10078
|
|
|
jQuery.offset.setOffset( this, options, i ); |
10079
|
|
|
} ); |
10080
|
|
|
} |
10081
|
|
|
|
10082
|
|
|
var rect, win, |
10083
|
|
|
elem = this[ 0 ]; |
10084
|
|
|
|
10085
|
|
|
if ( !elem ) { |
10086
|
|
|
return; |
10087
|
|
|
} |
10088
|
|
|
|
10089
|
|
|
// Return zeros for disconnected and hidden (display: none) elements (gh-2310) |
10090
|
|
|
// Support: IE <=11 only |
10091
|
|
|
// Running getBoundingClientRect on a |
10092
|
|
|
// disconnected node in IE throws an error |
10093
|
|
|
if ( !elem.getClientRects().length ) { |
10094
|
|
|
return { top: 0, left: 0 }; |
10095
|
|
|
} |
10096
|
|
|
|
10097
|
|
|
// Get document-relative position by adding viewport scroll to viewport-relative gBCR |
10098
|
|
|
rect = elem.getBoundingClientRect(); |
10099
|
|
|
win = elem.ownerDocument.defaultView; |
10100
|
|
|
return { |
10101
|
|
|
top: rect.top + win.pageYOffset, |
10102
|
|
|
left: rect.left + win.pageXOffset |
10103
|
|
|
}; |
10104
|
|
|
}, |
10105
|
|
|
|
10106
|
|
|
// position() relates an element's margin box to its offset parent's padding box |
10107
|
|
|
// This corresponds to the behavior of CSS absolute positioning |
10108
|
|
|
position: function() { |
10109
|
|
|
if ( !this[ 0 ] ) { |
10110
|
|
|
return; |
10111
|
|
|
} |
10112
|
|
|
|
10113
|
|
|
var offsetParent, offset, doc, |
10114
|
|
|
elem = this[ 0 ], |
10115
|
|
|
parentOffset = { top: 0, left: 0 }; |
10116
|
|
|
|
10117
|
|
|
// position:fixed elements are offset from the viewport, which itself always has zero offset |
10118
|
|
|
if ( jQuery.css( elem, "position" ) === "fixed" ) { |
10119
|
|
|
|
10120
|
|
|
// Assume position:fixed implies availability of getBoundingClientRect |
10121
|
|
|
offset = elem.getBoundingClientRect(); |
10122
|
|
|
|
10123
|
|
|
} else { |
10124
|
|
|
offset = this.offset(); |
10125
|
|
|
|
10126
|
|
|
// Account for the *real* offset parent, which can be the document or its root element |
10127
|
|
|
// when a statically positioned element is identified |
10128
|
|
|
doc = elem.ownerDocument; |
10129
|
|
|
offsetParent = elem.offsetParent || doc.documentElement; |
10130
|
|
|
while ( offsetParent && |
10131
|
|
|
( offsetParent === doc.body || offsetParent === doc.documentElement ) && |
10132
|
|
|
jQuery.css( offsetParent, "position" ) === "static" ) { |
10133
|
|
|
|
10134
|
|
|
offsetParent = offsetParent.parentNode; |
10135
|
|
|
} |
10136
|
|
|
if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { |
10137
|
|
|
|
10138
|
|
|
// Incorporate borders into its offset, since they are outside its content origin |
10139
|
|
|
parentOffset = jQuery( offsetParent ).offset(); |
10140
|
|
|
parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); |
10141
|
|
|
parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); |
10142
|
|
|
} |
10143
|
|
|
} |
10144
|
|
|
|
10145
|
|
|
// Subtract parent offsets and element margins |
10146
|
|
|
return { |
10147
|
|
|
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), |
10148
|
|
|
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) |
10149
|
|
|
}; |
10150
|
|
|
}, |
10151
|
|
|
|
10152
|
|
|
// This method will return documentElement in the following cases: |
10153
|
|
|
// 1) For the element inside the iframe without offsetParent, this method will return |
10154
|
|
|
// documentElement of the parent window |
10155
|
|
|
// 2) For the hidden or detached element |
10156
|
|
|
// 3) For body or html element, i.e. in case of the html node - it will return itself |
10157
|
|
|
// |
10158
|
|
|
// but those exceptions were never presented as a real life use-cases |
10159
|
|
|
// and might be considered as more preferable results. |
10160
|
|
|
// |
10161
|
|
|
// This logic, however, is not guaranteed and can change at any point in the future |
10162
|
|
|
offsetParent: function() { |
10163
|
|
|
return this.map( function() { |
10164
|
|
|
var offsetParent = this.offsetParent; |
10165
|
|
|
|
10166
|
|
|
while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { |
10167
|
|
|
offsetParent = offsetParent.offsetParent; |
10168
|
|
|
} |
10169
|
|
|
|
10170
|
|
|
return offsetParent || documentElement; |
10171
|
|
|
} ); |
10172
|
|
|
} |
10173
|
|
|
} ); |
10174
|
|
|
|
10175
|
|
|
// Create scrollLeft and scrollTop methods |
10176
|
|
|
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { |
10177
|
|
|
var top = "pageYOffset" === prop; |
10178
|
|
|
|
10179
|
|
|
jQuery.fn[ method ] = function( val ) { |
10180
|
|
|
return access( this, function( elem, method, val ) { |
10181
|
|
|
|
10182
|
|
|
// Coalesce documents and windows |
10183
|
|
|
var win; |
10184
|
|
|
if ( isWindow( elem ) ) { |
10185
|
|
|
win = elem; |
10186
|
|
|
} else if ( elem.nodeType === 9 ) { |
10187
|
|
|
win = elem.defaultView; |
10188
|
|
|
} |
10189
|
|
|
|
10190
|
|
|
if ( val === undefined ) { |
10191
|
|
|
return win ? win[ prop ] : elem[ method ]; |
10192
|
|
|
} |
10193
|
|
|
|
10194
|
|
|
if ( win ) { |
10195
|
|
|
win.scrollTo( |
10196
|
|
|
!top ? val : win.pageXOffset, |
10197
|
|
|
top ? val : win.pageYOffset |
10198
|
|
|
); |
10199
|
|
|
|
10200
|
|
|
} else { |
10201
|
|
|
elem[ method ] = val; |
10202
|
|
|
} |
10203
|
|
|
}, method, val, arguments.length ); |
10204
|
|
|
}; |
10205
|
|
|
} ); |
10206
|
|
|
|
10207
|
|
|
// Support: Safari <=7 - 9.1, Chrome <=37 - 49 |
10208
|
|
|
// Add the top/left cssHooks using jQuery.fn.position |
10209
|
|
|
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 |
10210
|
|
|
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 |
10211
|
|
|
// getComputedStyle returns percent when specified for top/left/bottom/right; |
10212
|
|
|
// rather than make the css module depend on the offset module, just check for it here |
10213
|
|
|
jQuery.each( [ "top", "left" ], function( i, prop ) { |
10214
|
|
|
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, |
10215
|
|
|
function( elem, computed ) { |
10216
|
|
|
if ( computed ) { |
10217
|
|
|
computed = curCSS( elem, prop ); |
10218
|
|
|
|
10219
|
|
|
// If curCSS returns percentage, fallback to offset |
10220
|
|
|
return rnumnonpx.test( computed ) ? |
10221
|
|
|
jQuery( elem ).position()[ prop ] + "px" : |
10222
|
|
|
computed; |
10223
|
|
|
} |
10224
|
|
|
} |
10225
|
|
|
); |
10226
|
|
|
} ); |
10227
|
|
|
|
10228
|
|
|
|
10229
|
|
|
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
10230
|
|
|
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
10231
|
|
|
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, |
10232
|
|
|
function( defaultExtra, funcName ) { |
10233
|
|
|
|
10234
|
|
|
// Margin is only for outerHeight, outerWidth |
10235
|
|
|
jQuery.fn[ funcName ] = function( margin, value ) { |
10236
|
|
|
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
10237
|
|
|
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
10238
|
|
|
|
10239
|
|
|
return access( this, function( elem, type, value ) { |
10240
|
|
|
var doc; |
10241
|
|
|
|
10242
|
|
|
if ( isWindow( elem ) ) { |
10243
|
|
|
|
10244
|
|
|
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) |
10245
|
|
|
return funcName.indexOf( "outer" ) === 0 ? |
10246
|
|
|
elem[ "inner" + name ] : |
10247
|
|
|
elem.document.documentElement[ "client" + name ]; |
10248
|
|
|
} |
10249
|
|
|
|
10250
|
|
|
// Get document width or height |
10251
|
|
|
if ( elem.nodeType === 9 ) { |
10252
|
|
|
doc = elem.documentElement; |
10253
|
|
|
|
10254
|
|
|
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
10255
|
|
|
// whichever is greatest |
10256
|
|
|
return Math.max( |
10257
|
|
|
elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
10258
|
|
|
elem.body[ "offset" + name ], doc[ "offset" + name ], |
10259
|
|
|
doc[ "client" + name ] |
10260
|
|
|
); |
10261
|
|
|
} |
10262
|
|
|
|
10263
|
|
|
return value === undefined ? |
10264
|
|
|
|
10265
|
|
|
// Get width or height on the element, requesting but not forcing parseFloat |
10266
|
|
|
jQuery.css( elem, type, extra ) : |
10267
|
|
|
|
10268
|
|
|
// Set width or height on the element |
10269
|
|
|
jQuery.style( elem, type, value, extra ); |
10270
|
|
|
}, type, chainable ? margin : undefined, chainable ); |
10271
|
|
|
}; |
10272
|
|
|
} ); |
10273
|
|
|
} ); |
10274
|
|
|
|
10275
|
|
|
|
10276
|
|
|
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + |
10277
|
|
|
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
10278
|
|
|
"change select submit keydown keypress keyup contextmenu" ).split( " " ), |
10279
|
|
|
function( i, name ) { |
10280
|
|
|
|
10281
|
|
|
// Handle event binding |
10282
|
|
|
jQuery.fn[ name ] = function( data, fn ) { |
10283
|
|
|
return arguments.length > 0 ? |
10284
|
|
|
this.on( name, null, data, fn ) : |
10285
|
|
|
this.trigger( name ); |
10286
|
|
|
}; |
10287
|
|
|
} ); |
10288
|
|
|
|
10289
|
|
|
jQuery.fn.extend( { |
10290
|
|
|
hover: function( fnOver, fnOut ) { |
10291
|
|
|
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
10292
|
|
|
} |
10293
|
|
|
} ); |
10294
|
|
|
|
10295
|
|
|
|
10296
|
|
|
|
10297
|
|
|
|
10298
|
|
|
jQuery.fn.extend( { |
10299
|
|
|
|
10300
|
|
|
bind: function( types, data, fn ) { |
10301
|
|
|
return this.on( types, null, data, fn ); |
10302
|
|
|
}, |
10303
|
|
|
unbind: function( types, fn ) { |
10304
|
|
|
return this.off( types, null, fn ); |
10305
|
|
|
}, |
10306
|
|
|
|
10307
|
|
|
delegate: function( selector, types, data, fn ) { |
10308
|
|
|
return this.on( types, selector, data, fn ); |
10309
|
|
|
}, |
10310
|
|
|
undelegate: function( selector, types, fn ) { |
10311
|
|
|
|
10312
|
|
|
// ( namespace ) or ( selector, types [, fn] ) |
10313
|
|
|
return arguments.length === 1 ? |
10314
|
|
|
this.off( selector, "**" ) : |
10315
|
|
|
this.off( types, selector || "**", fn ); |
10316
|
|
|
} |
10317
|
|
|
} ); |
10318
|
|
|
|
10319
|
|
|
// Bind a function to a context, optionally partially applying any |
10320
|
|
|
// arguments. |
10321
|
|
|
// jQuery.proxy is deprecated to promote standards (specifically Function#bind) |
10322
|
|
|
// However, it is not slated for removal any time soon |
10323
|
|
|
jQuery.proxy = function( fn, context ) { |
10324
|
|
|
var tmp, args, proxy; |
10325
|
|
|
|
10326
|
|
|
if ( typeof context === "string" ) { |
10327
|
|
|
tmp = fn[ context ]; |
10328
|
|
|
context = fn; |
10329
|
|
|
fn = tmp; |
10330
|
|
|
} |
10331
|
|
|
|
10332
|
|
|
// Quick check to determine if target is callable, in the spec |
10333
|
|
|
// this throws a TypeError, but we will just return undefined. |
10334
|
|
|
if ( !isFunction( fn ) ) { |
10335
|
|
|
return undefined; |
10336
|
|
|
} |
10337
|
|
|
|
10338
|
|
|
// Simulated bind |
10339
|
|
|
args = slice.call( arguments, 2 ); |
10340
|
|
|
proxy = function() { |
10341
|
|
|
return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); |
10342
|
|
|
}; |
10343
|
|
|
|
10344
|
|
|
// Set the guid of unique handler to the same of original handler, so it can be removed |
10345
|
|
|
proxy.guid = fn.guid = fn.guid || jQuery.guid++; |
10346
|
|
|
|
10347
|
|
|
return proxy; |
10348
|
|
|
}; |
10349
|
|
|
|
10350
|
|
|
jQuery.holdReady = function( hold ) { |
10351
|
|
|
if ( hold ) { |
10352
|
|
|
jQuery.readyWait++; |
10353
|
|
|
} else { |
10354
|
|
|
jQuery.ready( true ); |
10355
|
|
|
} |
10356
|
|
|
}; |
10357
|
|
|
jQuery.isArray = Array.isArray; |
10358
|
|
|
jQuery.parseJSON = JSON.parse; |
10359
|
|
|
jQuery.nodeName = nodeName; |
10360
|
|
|
jQuery.isFunction = isFunction; |
10361
|
|
|
jQuery.isWindow = isWindow; |
10362
|
|
|
jQuery.camelCase = camelCase; |
10363
|
|
|
jQuery.type = toType; |
10364
|
|
|
|
10365
|
|
|
jQuery.now = Date.now; |
10366
|
|
|
|
10367
|
|
|
jQuery.isNumeric = function( obj ) { |
10368
|
|
|
|
10369
|
|
|
// As of jQuery 3.0, isNumeric is limited to |
10370
|
|
|
// strings and numbers (primitives or objects) |
10371
|
|
|
// that can be coerced to finite numbers (gh-2662) |
10372
|
|
|
var type = jQuery.type( obj ); |
10373
|
|
|
return ( type === "number" || type === "string" ) && |
10374
|
|
|
|
10375
|
|
|
// parseFloat NaNs numeric-cast false positives ("") |
10376
|
|
|
// ...but misinterprets leading-number strings, particularly hex literals ("0x...") |
10377
|
|
|
// subtraction forces infinities to NaN |
10378
|
|
|
!isNaN( obj - parseFloat( obj ) ); |
10379
|
|
|
}; |
10380
|
|
|
|
10381
|
|
|
|
10382
|
|
|
|
10383
|
|
|
|
10384
|
|
|
// Register as a named AMD module, since jQuery can be concatenated with other |
10385
|
|
|
// files that may use define, but not via a proper concatenation script that |
10386
|
|
|
// understands anonymous AMD modules. A named AMD is safest and most robust |
10387
|
|
|
// way to register. Lowercase jquery is used because AMD module names are |
10388
|
|
|
// derived from file names, and jQuery is normally delivered in a lowercase |
10389
|
|
|
// file name. Do this after creating the global so that if an AMD module wants |
10390
|
|
|
// to call noConflict to hide this version of jQuery, it will work. |
10391
|
|
|
|
10392
|
|
|
// Note that for maximum portability, libraries that are not jQuery should |
10393
|
|
|
// declare themselves as anonymous modules, and avoid setting a global if an |
10394
|
|
|
// AMD loader is present. jQuery is a special case. For more information, see |
10395
|
|
|
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon |
10396
|
|
|
|
10397
|
|
|
if ( true ) { |
10398
|
|
|
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { |
10399
|
|
|
return jQuery; |
10400
|
|
|
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), |
10401
|
|
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
10402
|
|
|
} |
10403
|
|
|
|
10404
|
|
|
|
10405
|
|
|
|
10406
|
|
|
|
10407
|
|
|
var |
10408
|
|
|
|
10409
|
|
|
// Map over jQuery in case of overwrite |
10410
|
|
|
_jQuery = window.jQuery, |
10411
|
|
|
|
10412
|
|
|
// Map over the $ in case of overwrite |
10413
|
|
|
_$ = window.$; |
10414
|
|
|
|
10415
|
|
|
jQuery.noConflict = function( deep ) { |
10416
|
|
|
if ( window.$ === jQuery ) { |
10417
|
|
|
window.$ = _$; |
10418
|
|
|
} |
10419
|
|
|
|
10420
|
|
|
if ( deep && window.jQuery === jQuery ) { |
10421
|
|
|
window.jQuery = _jQuery; |
10422
|
|
|
} |
10423
|
|
|
|
10424
|
|
|
return jQuery; |
10425
|
|
|
}; |
10426
|
|
|
|
10427
|
|
|
// Expose jQuery and $ identifiers, even in AMD |
10428
|
|
|
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) |
10429
|
|
|
// and CommonJS for browser emulators (#13566) |
10430
|
|
|
if ( !noGlobal ) { |
10431
|
|
|
window.jQuery = window.$ = jQuery; |
10432
|
|
|
} |
10433
|
|
|
|
10434
|
|
|
|
10435
|
|
|
|
10436
|
|
|
|
10437
|
|
|
return jQuery; |
10438
|
|
|
} ); |
10439
|
|
|
|
10440
|
|
|
|
10441
|
|
|
/***/ }), |
10442
|
|
|
|
10443
|
|
|
/***/ 10: |
10444
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
10445
|
|
|
|
10446
|
|
|
/* WEBPACK VAR INJECTION */(function($, jQuery) {$(document).ready(function () { |
10447
|
|
|
|
10448
|
|
|
/* |
10449
|
|
|
* jQuery accessible and keyboard-enhanced autocomplete list |
10450
|
|
|
* @version v1.6.0 |
10451
|
|
|
* Website: https://a11y.nicolas-hoffmann.net/autocomplet-list/ |
10452
|
|
|
* License MIT: https://github.com/nico3333fr/jquery-accessible-autocomplete-list-aria/blob/master/LICENSE |
10453
|
|
|
*/ |
10454
|
|
|
// loading combobox ------------------------------------------------------------------------------------------------------------ |
10455
|
|
|
// init |
10456
|
|
|
var $js_combobox = $('.js-combobox'), |
10457
|
|
|
$body = $('body'), |
10458
|
|
|
|
10459
|
|
|
// default_text_help = 'Use tabulation (or down) key to access and browse suggestions after input. Confirm your choice with enter key, or esc key to close suggestions box.', |
10460
|
|
|
default_text_help = '', |
10461
|
|
|
default_class_for_invisible_text = 'invisible', |
10462
|
|
|
suggestion_single = 'There is ', |
10463
|
|
|
suggestion_plural = 'There are ', |
10464
|
|
|
suggestion_word = 'suggestion', |
10465
|
|
|
suggestion_word_plural = 'suggestions', |
10466
|
|
|
button_clear_title = 'clear this field', |
10467
|
|
|
button_clear_text = 'X', |
10468
|
|
|
case_sensitive = 'no', |
10469
|
|
|
min_length = 0, |
10470
|
|
|
limit_number_suggestions = 666, |
10471
|
|
|
search_option = 'beginning', |
10472
|
|
|
// or 'containing' |
10473
|
|
|
see_more_text = 'See more results…', |
10474
|
|
|
tablo_suggestions = []; |
10475
|
|
|
|
10476
|
|
|
function do_see_more_option() { |
10477
|
|
|
var $output_content = $('#js-codeit'); |
10478
|
|
|
$output_content.html('You have to code a function or a redirection to display more results ;)'); |
10479
|
|
|
} |
10480
|
|
|
|
10481
|
|
|
if ($js_combobox.length) { |
10482
|
|
|
// if there are at least one :) |
10483
|
|
|
|
10484
|
|
|
// init |
10485
|
|
|
$js_combobox.each(function (index_combo) { |
10486
|
|
|
var $this = $(this), |
10487
|
|
|
$this_id = $this.attr('id'), |
10488
|
|
|
$label_this = $('label[for="' + $this_id + '"]'), |
10489
|
|
|
index_lisible = index_combo + 1, |
10490
|
|
|
options = $this.data(), |
10491
|
|
|
$combobox_prefix_class = typeof options.comboboxPrefixClass !== 'undefined' ? options.comboboxPrefixClass + '-' : '', |
10492
|
|
|
$combobox_help_text = typeof options.comboboxHelpText !== 'undefined' ? options.comboboxHelpText : default_text_help, |
10493
|
|
|
$list_suggestions = $('#' + $this.attr('list')), |
10494
|
|
|
$combobox_button_title = typeof options.comboboxButtonTitle !== 'undefined' ? options.comboboxButtonTitle : button_clear_title, |
10495
|
|
|
$combobox_button_text = typeof options.comboboxButtonText !== 'undefined' ? options.comboboxButtonText : button_clear_text, |
10496
|
|
|
$combobox_case_sensitive = typeof options.comboboxCaseSensitive !== 'undefined' ? options.comboboxCaseSensitive : case_sensitive, |
10497
|
|
|
tablo_temp_suggestions = []; |
10498
|
|
|
|
10499
|
|
|
// input |
10500
|
|
|
$this.attr({ |
10501
|
|
|
'data-number': index_lisible, |
10502
|
|
|
'autocorrect': 'off', |
10503
|
|
|
'autocapitalize': 'off', |
10504
|
|
|
'spellcheck': 'false', |
10505
|
|
|
'autocomplete': 'off', |
10506
|
|
|
'aria-describedby': $combobox_prefix_class + 'help-text' + index_lisible, |
10507
|
|
|
'aria-autocomplete': 'list', |
10508
|
|
|
'data-lastval': '', |
10509
|
|
|
'aria-owns': $combobox_prefix_class + 'suggest_' + index_lisible |
10510
|
|
|
}); |
10511
|
|
|
// stock into tables |
10512
|
|
|
$list_suggestions.find('option').each(function (index_option, index_element) { |
10513
|
|
|
tablo_temp_suggestions.push(index_element.value); |
10514
|
|
|
}); |
10515
|
|
|
if ($combobox_case_sensitive === 'no') { |
10516
|
|
|
// order case tablo_temp_suggestions |
10517
|
|
|
tablo_suggestions[index_lisible] = tablo_temp_suggestions.sort(function (a, b) { |
10518
|
|
|
a = a.toLowerCase(); |
10519
|
|
|
b = b.toLowerCase(); |
10520
|
|
|
if (a == b) { |
10521
|
|
|
return 0; |
10522
|
|
|
} |
10523
|
|
|
if (a > b) { |
10524
|
|
|
return 1; |
10525
|
|
|
} |
10526
|
|
|
return -1; |
10527
|
|
|
}); |
10528
|
|
|
} else { |
10529
|
|
|
tablo_suggestions[index_lisible] = tablo_temp_suggestions.sort(); |
10530
|
|
|
} |
10531
|
|
|
|
10532
|
|
|
// wrap into a container |
10533
|
|
|
$this.wrap('<div class="' + $combobox_prefix_class + 'container js-container" data-combobox-prefix-class="' + $combobox_prefix_class + '"></div>'); |
10534
|
|
|
|
10535
|
|
|
var $combobox_container = $this.parent(); |
10536
|
|
|
|
10537
|
|
|
// custom datalist/listbox linked to input |
10538
|
|
|
$combobox_container.append('<div id="' + $combobox_prefix_class + 'suggest_' + index_lisible + '" class="js-suggest ' + $combobox_prefix_class + 'suggestions"><div role="listbox"></div></div>'); |
10539
|
|
|
$list_suggestions.remove(); |
10540
|
|
|
|
10541
|
|
|
// status zone |
10542
|
|
|
// $combobox_container.prepend('<div id="' + $combobox_prefix_class + 'suggestion-text' + index_lisible + '" class="js-suggestion-text ' + $combobox_prefix_class + 'suggestion-text ' + default_class_for_invisible_text + '" aria-live="assertive"></div>'); |
10543
|
|
|
|
10544
|
|
|
// help text |
10545
|
|
|
$combobox_container.prepend('<span id="' + $combobox_prefix_class + 'help-text' + index_lisible + '" class="' + $combobox_prefix_class + 'help-text ' + default_class_for_invisible_text + '">' + $combobox_help_text + '</span>'); |
10546
|
|
|
|
10547
|
|
|
// label id |
10548
|
|
|
$label_this.attr('id', 'label-id-' + $this_id); |
10549
|
|
|
|
10550
|
|
|
// button clear |
10551
|
|
|
$this.after('<button class="js-clear-button ' + $combobox_prefix_class + 'clear-button" aria-label="' + $combobox_button_title + '" title="' + $combobox_button_title + '" aria-describedby="label-id-' + $this_id + '" type="button">' + $combobox_button_text + '</button>'); |
10552
|
|
|
}); |
10553
|
|
|
|
10554
|
|
|
// listeners |
10555
|
|
|
// keydown on field |
10556
|
|
|
$body.on('keyup', '.js-combobox', function (event) { |
10557
|
|
|
var $this = $(this), |
10558
|
|
|
options_combo = $this.data(), |
10559
|
|
|
$container = $this.parent(), |
10560
|
|
|
$form = $container.parents('form'), |
10561
|
|
|
options = $container.data(), |
10562
|
|
|
$combobox_prefix_class = typeof options.comboboxPrefixClass !== 'undefined' ? options.comboboxPrefixClass : '', |
10563
|
|
|
// no "-"" because already generated |
10564
|
|
|
$suggestions = $container.find('.js-suggest div'), |
10565
|
|
|
|
10566
|
|
|
//$suggestion_list = $suggestions.find('.js-suggestion'), |
10567
|
|
|
$suggestions_text = $container.find('.js-suggestion-text'), |
10568
|
|
|
$combobox_suggestion_single = typeof options_combo.suggestionSingle !== 'undefined' ? options_combo.suggestionSingle : suggestion_single, |
10569
|
|
|
$combobox_suggestion_plural = typeof options_combo.suggestionPlural !== 'undefined' ? options_combo.suggestionPlural : suggestion_plural, |
10570
|
|
|
$combobox_suggestion_word = typeof options_combo.suggestionWord !== 'undefined' ? options_combo.suggestionWord : suggestion_word, |
10571
|
|
|
$combobox_suggestion_word_plural = typeof options_combo.suggestionWord !== 'undefined' ? options_combo.suggestionWordPlural : suggestion_word_plural, |
10572
|
|
|
combobox_min_length = typeof options_combo.comboboxMinLength !== 'undefined' ? Math.abs(options_combo.comboboxMinLength) : min_length, |
10573
|
|
|
$combobox_case_sensitive = typeof options_combo.comboboxCaseSensitive !== 'undefined' ? options_combo.comboboxCaseSensitive : case_sensitive, |
10574
|
|
|
combobox_limit_number_suggestions = typeof options_combo.comboboxLimitNumberSuggestions !== 'undefined' ? Math.abs(options_combo.comboboxLimitNumberSuggestions) : limit_number_suggestions, |
10575
|
|
|
$combobox_search_option = typeof options_combo.comboboxSearchOption !== 'undefined' ? options_combo.comboboxSearchOption : search_option, |
10576
|
|
|
$combobox_see_more_text = typeof options_combo.comboboxSeeMoreText !== 'undefined' ? options_combo.comboboxSeeMoreText : see_more_text, |
10577
|
|
|
index_table = $this.attr('data-number'), |
10578
|
|
|
value_to_search = $this.val(), |
10579
|
|
|
text_number_suggestions = ''; |
10580
|
|
|
|
10581
|
|
|
if (event.keyCode === 13) { |
10582
|
|
|
$form.submit(); |
10583
|
|
|
} else { |
10584
|
|
|
|
10585
|
|
|
if (event.keyCode !== 27) { |
10586
|
|
|
// No Escape |
10587
|
|
|
|
10588
|
|
|
$this.attr('data-lastval', value_to_search); |
10589
|
|
|
// search for text suggestion in the array tablo_suggestions[index_table] |
10590
|
|
|
var size_tablo = tablo_suggestions[index_table].length, |
10591
|
|
|
i = 0, |
10592
|
|
|
counter = 0; |
10593
|
|
|
|
10594
|
|
|
$suggestions.empty(); |
10595
|
|
|
|
10596
|
|
|
if (value_to_search != '' && value_to_search.length >= combobox_min_length) { |
10597
|
|
|
while (i < size_tablo) { |
10598
|
|
|
if (counter < combobox_limit_number_suggestions) { |
10599
|
|
|
if ($combobox_search_option === 'containing' && ($combobox_case_sensitive === 'yes' && tablo_suggestions[index_table][i].indexOf(value_to_search) >= 0 || $combobox_case_sensitive === 'no' && tablo_suggestions[index_table][i].toUpperCase().indexOf(value_to_search.toUpperCase()) >= 0) || $combobox_search_option === 'beginning' && ($combobox_case_sensitive === 'yes' && tablo_suggestions[index_table][i].substring(0, value_to_search.length) === value_to_search || $combobox_case_sensitive === 'no' && tablo_suggestions[index_table][i].substring(0, value_to_search.length).toUpperCase() === value_to_search.toUpperCase())) { |
10600
|
|
|
$suggestions.append('<div id="suggestion-' + index_table + '-' + counter + '" class="js-suggestion ' + $combobox_prefix_class + 'suggestion" tabindex="-1" role="option">' + tablo_suggestions[index_table][i] + '</div>'); |
10601
|
|
|
counter++; |
10602
|
|
|
} |
10603
|
|
|
} |
10604
|
|
|
i++; |
10605
|
|
|
} |
10606
|
|
|
if (counter >= combobox_limit_number_suggestions) { |
10607
|
|
|
$suggestions.append('<div id="suggestion-' + index_table + '-' + counter + '" class="js-suggestion js-seemore ' + $combobox_prefix_class + 'suggestion" tabindex="-1" role="option">' + $combobox_see_more_text + '</div>'); |
10608
|
|
|
counter++; |
10609
|
|
|
} |
10610
|
|
|
// update number of suggestions |
10611
|
|
|
if (counter > 1) { |
10612
|
|
|
text_number_suggestions = $combobox_suggestion_plural + counter + ' ' + $combobox_suggestion_word_plural + '.'; |
10613
|
|
|
} |
10614
|
|
|
if (counter === 1) { |
10615
|
|
|
text_number_suggestions = $combobox_suggestion_single + counter + ' ' + $combobox_suggestion_word + '.'; |
10616
|
|
|
} |
10617
|
|
|
if (counter === 0) { |
10618
|
|
|
text_number_suggestions = $combobox_suggestion_single + counter + ' ' + $combobox_suggestion_word + '.'; |
10619
|
|
|
} |
10620
|
|
|
if (counter >= 0) { |
10621
|
|
|
var text_number_suggestions_default = $suggestions_text.text(); |
10622
|
|
|
if (text_number_suggestions != text_number_suggestions_default) { |
10623
|
|
|
// @Goestu trick to make it work on all AT |
10624
|
|
|
var suggestions_to_add = $("<p>").text(text_number_suggestions); |
10625
|
|
|
$suggestions_text.attr('aria-live', 'polite'); |
10626
|
|
|
$suggestions_text.empty(); |
10627
|
|
|
$suggestions_text.append(suggestions_to_add); |
10628
|
|
|
} |
10629
|
|
|
} |
10630
|
|
|
} |
10631
|
|
|
} |
10632
|
|
|
} |
10633
|
|
|
}).on('click', function (event) { |
10634
|
|
|
var $target = $(event.target), |
10635
|
|
|
$suggestions_text = $('.js-suggestion-text:not(:empty)'), |
10636
|
|
|
// if a suggestion text is not empty => suggestion opened somewhere |
10637
|
|
|
$container = $suggestions_text.parents('.js-container'), |
10638
|
|
|
$input_text = $container.find('.js-combobox'), |
10639
|
|
|
$suggestions = $container.find('.js-suggest div'); |
10640
|
|
|
|
10641
|
|
|
// if click outside => close opened suggestions |
10642
|
|
|
if (!$target.is('.js-suggestion') && !$target.is('.js-combobox') && $suggestions_text.length) { |
10643
|
|
|
$input_text.val($input_text.attr('data-lastval')); |
10644
|
|
|
$suggestions.empty(); |
10645
|
|
|
$suggestions_text.empty(); |
10646
|
|
|
} |
10647
|
|
|
}) |
10648
|
|
|
// tab + down management for autocomplete (when list of suggestion) |
10649
|
|
|
.on('keydown', '.js-combobox', function (event) { |
10650
|
|
|
var $this = $(this), |
10651
|
|
|
$container = $this.parent(), |
10652
|
|
|
$input_text = $container.find('.js-combobox'), |
10653
|
|
|
$suggestions = $container.find('.js-suggest div'), |
10654
|
|
|
$suggestion_list = $suggestions.find('.js-suggestion'), |
10655
|
|
|
$suggestions_text = $container.find('.js-suggestion-text'), |
10656
|
|
|
$autorise_tab_options = typeof $this.attr('data-combobox-notab-options') !== 'undefined' ? false : true, |
10657
|
|
|
$first_suggestion = $suggestion_list.first(); |
10658
|
|
|
|
10659
|
|
|
if (!event.shiftKey && event.keyCode == 9 && $autorise_tab_options || event.keyCode == 40) { |
10660
|
|
|
// tab (if authorised) or bottom |
10661
|
|
|
// See if there are suggestions, and yes => focus on first one |
10662
|
|
|
if ($suggestion_list.length) { |
10663
|
|
|
$input_text.val($first_suggestion.html()); |
10664
|
|
|
$suggestion_list.first().focus(); |
10665
|
|
|
event.preventDefault(); |
10666
|
|
|
} |
10667
|
|
|
} |
10668
|
|
|
if (event.keyCode == 27 || $autorise_tab_options === false && event.keyCode == 9) { |
10669
|
|
|
// esc or (tab/shift tab + notab option) = close |
10670
|
|
|
$input_text.val($input_text.attr('data-lastval')); |
10671
|
|
|
$suggestions.empty(); |
10672
|
|
|
$suggestions_text.empty(); |
10673
|
|
|
if (event.keyCode == 27) { |
10674
|
|
|
// Esc prevented only, tab can go :) |
10675
|
|
|
event.preventDefault(); |
10676
|
|
|
setTimeout(function () { |
10677
|
|
|
$input_text.focus(); |
10678
|
|
|
}, 300); // timeout to avoid problem in suggestions display |
10679
|
|
|
} |
10680
|
|
|
} |
10681
|
|
|
}) |
10682
|
|
|
// tab + down management in list of suggestions |
10683
|
|
|
.on('keydown', '.js-suggestion', function (event) { |
10684
|
|
|
var $this = $(this), |
10685
|
|
|
$container = $this.parents('.js-container'), |
10686
|
|
|
$input_text = $container.find('.js-combobox'), |
10687
|
|
|
$autorise_tab_options = typeof $input_text.attr('data-combobox-notab-options') !== 'undefined' ? false : true, |
10688
|
|
|
$suggestions = $container.find('.js-suggest div'), |
10689
|
|
|
$suggestions_text = $container.find('.js-suggestion-text'), |
10690
|
|
|
$next_suggestion = $this.next(), |
10691
|
|
|
$previous_suggestion = $this.prev(); |
10692
|
|
|
|
10693
|
|
|
if (event.keyCode == 27 || $autorise_tab_options === false && event.keyCode == 9) { |
10694
|
|
|
// esc or (tab/shift tab + notab option) = close |
10695
|
|
|
if (event.keyCode == 27) { |
10696
|
|
|
// Esc prevented only, tab can go :) |
10697
|
|
|
$input_text.val($input_text.attr('data-lastval')); |
10698
|
|
|
$suggestions.empty(); |
10699
|
|
|
$suggestions_text.empty(); |
10700
|
|
|
setTimeout(function () { |
10701
|
|
|
$input_text.focus(); |
10702
|
|
|
}, 300); // timeout to avoid problem in suggestions display |
10703
|
|
|
event.preventDefault(); |
10704
|
|
|
} |
10705
|
|
|
if ($autorise_tab_options === false && event.keyCode == 9) { |
10706
|
|
|
$suggestions.empty(); |
10707
|
|
|
$suggestions_text.empty(); |
10708
|
|
|
$input_text.focus(); |
10709
|
|
|
} |
10710
|
|
|
} |
10711
|
|
|
if (event.keyCode == 13 || event.keyCode == 32) { |
10712
|
|
|
// Enter or space |
10713
|
|
|
if ($this.hasClass('js-seemore')) { |
10714
|
|
|
$input_text.val($input_text.attr('data-lastval')); |
10715
|
|
|
$suggestions.empty(); |
10716
|
|
|
$suggestions_text.empty(); |
10717
|
|
|
setTimeout(function () { |
10718
|
|
|
$input_text.focus(); |
10719
|
|
|
}, 300); // timeout to avoid problem in suggestions display |
10720
|
|
|
// go define the function you need when we click the see_more option |
10721
|
|
|
setTimeout(function () { |
10722
|
|
|
do_see_more_option(); |
10723
|
|
|
}, 301); // timeout to avoid problem in suggestions display |
10724
|
|
|
event.preventDefault(); |
10725
|
|
|
} else { |
10726
|
|
|
$input_text.val($this.html()); |
10727
|
|
|
$input_text.attr('data-lastval', $this.html()); |
10728
|
|
|
$suggestions.empty(); |
10729
|
|
|
$suggestions_text.empty(); |
10730
|
|
|
setTimeout(function () { |
10731
|
|
|
$input_text.focus(); |
10732
|
|
|
}, 300); // timeout to avoid problem in suggestions display |
10733
|
|
|
event.preventDefault(); |
10734
|
|
|
} |
10735
|
|
|
} |
10736
|
|
|
if (!event.shiftKey && event.keyCode == 9 && $autorise_tab_options || event.keyCode == 40) { |
10737
|
|
|
// tab (if authorised) or bottom |
10738
|
|
|
if ($next_suggestion.length) { |
10739
|
|
|
$input_text.val($next_suggestion.html()); |
10740
|
|
|
$next_suggestion.focus(); |
10741
|
|
|
} else { |
10742
|
|
|
$input_text.val($input_text.attr('data-lastval')); |
10743
|
|
|
if (!event.shiftKey && event.keyCode == 9) { |
10744
|
|
|
// tab closes the list |
10745
|
|
|
var e = jQuery.Event("keydown"); |
10746
|
|
|
e.which = 27; // # Some key code value |
10747
|
|
|
e.keyCode = 27; |
10748
|
|
|
$this.trigger(e); |
10749
|
|
|
} else { |
10750
|
|
|
setTimeout(function () { |
10751
|
|
|
$input_text.focus(); |
10752
|
|
|
}, 300); |
10753
|
|
|
} // timeout to avoid problem in suggestions display |
10754
|
|
|
} |
10755
|
|
|
event.preventDefault(); |
10756
|
|
|
} |
10757
|
|
|
|
10758
|
|
|
if (event.shiftKey && event.keyCode == 9 && $autorise_tab_options || event.keyCode == 38) { |
10759
|
|
|
// top or Maj+tab (if authorised) |
10760
|
|
|
if ($previous_suggestion.length) { |
10761
|
|
|
$input_text.val($previous_suggestion.html()); |
10762
|
|
|
$previous_suggestion.focus(); |
10763
|
|
|
} else { |
10764
|
|
|
$input_text.val($input_text.attr('data-lastval')).focus(); |
10765
|
|
|
} |
10766
|
|
|
event.preventDefault(); |
10767
|
|
|
} |
10768
|
|
|
}) |
10769
|
|
|
// clear button |
10770
|
|
|
.on('click', '.js-clear-button', function () { |
10771
|
|
|
var $this = $(this), |
10772
|
|
|
$container = $this.parent(), |
10773
|
|
|
$input_text = $container.find('.js-combobox'), |
10774
|
|
|
$suggestions = $container.find('.js-suggest div'), |
10775
|
|
|
$suggestions_text = $container.find('.js-suggestion-text'); |
10776
|
|
|
|
10777
|
|
|
$suggestions.empty(); |
10778
|
|
|
$suggestions_text.empty(); |
10779
|
|
|
$input_text.val(''); |
10780
|
|
|
$input_text.attr('data-lastval', ''); |
10781
|
|
|
}).on('click', '.js-suggestion', function () { |
10782
|
|
|
var $this = $(this), |
10783
|
|
|
value = $this.html(), |
10784
|
|
|
$container = $this.parents('.js-container'), |
10785
|
|
|
$input_text = $container.find('.js-combobox'), |
10786
|
|
|
$suggestions = $container.find('.js-suggest div'), |
10787
|
|
|
$suggestions_text = $container.find('.js-suggestion-text'); |
10788
|
|
|
|
10789
|
|
|
if ($this.hasClass('js-seemore')) { |
10790
|
|
|
$suggestions.empty(); |
10791
|
|
|
$suggestions_text.empty(); |
10792
|
|
|
$input_text.focus(); |
10793
|
|
|
// go define the function you need when we click the see_more option |
10794
|
|
|
do_see_more_option(); |
10795
|
|
|
} else { |
10796
|
|
|
$input_text.val(value).focus(); |
10797
|
|
|
$suggestions.empty(); |
10798
|
|
|
$suggestions_text.empty(); |
10799
|
|
|
} |
10800
|
|
|
}); |
10801
|
|
|
} |
10802
|
|
|
}); |
10803
|
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(1))) |
10804
|
|
|
|
10805
|
|
|
/***/ }), |
10806
|
|
|
|
10807
|
|
|
/***/ 34: |
10808
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
10809
|
|
|
|
10810
|
|
|
module.exports = __webpack_require__(10); |
10811
|
|
|
|
10812
|
|
|
|
10813
|
|
|
/***/ }) |
10814
|
|
|
|
10815
|
|
|
/******/ }); |